MicroX and Presto Range (8-Bit PIC board, mixed 3.3/5V) => Projects => Topic started by: emkowale on October 26, 2011, 10:31:46 AM

Title: New kid on the block that needs a little push.
Post by: emkowale on October 26, 2011, 10:31:46 AM

     This summer I bought a home that has simple door and window contact switches everywhere.  My goal is to have a device that simply tells me the state of these switches either via SNMP or my own polling software.  I purchased a SBC65EC and a PT24E-ASMI.  I got the boards, put them together, powered it up and logged in via the internal webserver.  This is just the sort of fun project I love to do.  However, I think I need a little push to get me started.  I've been programming for years.  I just need this device to tell me if the contact switches on my house doors are open or closed.  Can you point me in the right direction?  For starters, where to I plug the two wires from each switch?

Title: Re: New kid on the block that needs a little push.
Post by: Rick314 on October 26, 2011, 02:50:24 PM
The online data sheets and schematics for the SBC65EC and PT-24E-ASM allowed me to write a Java program to set the LEDs on the PT-24E-ASM using UDP.  Since it was for a school project I tried to comment the code well.  See

I also spent significant time on SNMP with the SBC65EC/SBC66EC, but abandoned them in favor of the Microchip PIC32 Ethernet Starter Kit: See

I think that with no actual firmware programming of the SBC65EC needed, its existing HTTP or UDP control interfaces can configure its digital I/O pins and use them for what you want.  Hopefully someone else will comment that has already done closer to what you want.
Title: Re: New kid on the block that needs a little push.
Post by: emkowale on October 27, 2011, 08:37:04 PM
I looked at your example.  It will help me out once I can get past one simple and probably obvious thing that I am missing.  Where do I plug in the switch?  There are 24 screw terminals on the pt24e-asm.  Do I use 1 and 2?  Once the switch is plugged in and I close the circuit, I should see a 1 or a 0 in the web interface somewhere.  Correct?

Title: Re: New kid on the block that needs a little push.
Post by: Rick314 on November 02, 2011, 11:02:18 PM
There is more work involved than I think you are imagining, but it is definitely within the capabilities of the SBC65EC and PT24E-ASM. is the 16-page SBC65EC Data Sheet.  Section 4 "Daughter Board Connectors" lists the signals between the SBC and the PT24E-ASM Proto Board. is the 4-page schematic/layout of the PT24E-ASM.  You will need to spend time understanding both documents.

One option for your window switches is given on the first page of the PT24E-ASM document, labeled "8 Way DIP Switch - NOT ASSEMBLED".  If you were to get and load those parts onto your PT24E-ASM, you would then be able to read the 8 DIP switches (or substitute window switches).  The 74HC165N shown on the schematic is a shift register, and reading the 8 switches involves shifting them in a single bit at a time, similar to what my Java program does for the LED outputs -- It is not trivial.  Maybe someone else has done this and posted software on the Forum somewhere that reads the switch shown in the schematic.  I didn't look.  You *can* do all the required operations from the SBC web pages, and in fact that is how I developed my Java program.  It isn't practical for actual use though.  For example, "set C0 to 0, then set C0 to 1" (2 manual operations using the web pages) puts an edge on it and does a single "shift".  Many such operations are required to get all 8 bits.  It is tedious for a human but easy for a program.

Sheet 2 of the PT24E-ASM shows the terminal blocks X1 and X2, with all pins being No Contact.  You have to connect them to other signals that come from the SBC.  Notice the signals from the SBC are labeled on the PT24E-ASM board itself, near the two connectors that the SBC mounts on.

If you wanted to avoid the shift register, some of the PIC I/O pins (RA0-RA5, RB0-RB7...) could be wired to the X1 and/or X2 terminal block using wires added to the PT24E-ASM board, and high/low levels put on them using pull-up resistors and window switches to ground.  I am summarizing here, and assuming some digital design knowledge.  Hopefully this just gives you an idea of a general path to be taken.
Title: Re: New kid on the block that needs a little push.
Post by: emkowale on November 03, 2011, 08:19:50 AM

     You're right.  This may be a bit more than my background allows.  However, I am still excited about this little project so I'll throw this out there...  Can I pay you to handle the low level stuff and get it to the point where I can interact with the system at a higher level?  I had some assembly and machine language stuff back in college, but I'm a PHP/database guy.

Title: Re: New kid on the block that needs a little push.
Post by: Rick314 on November 03, 2011, 08:54:30 AM

Sorry, but I am not interested in doing this for hire.  I did post a new thread to see if anyone else has done the coding to read the non-loaded DIP switch and shift register given on the PT24E-ASM schematic, here: