First sensor finished and working

Power wiresToday I finished soldering a cable to my first new All-in-one sensor with motion, temperature and light. Phew, after soldering those 7 wires my eyes really needed a break, even though I used a magnifying glass. The very first thing I did was getting rid of the headers for the H/L jumper; I reduced the 2headers I needed to 1 mm and added a drop of solder in between; the unused header was cut away completely. This gave me some more free space  for the black wire which connects the GND pin of the PIR to pin 1 (GND) of the DS18B20. After that I connected DS18B20 pin 3 (Vdd) and one leg of the LDR to each other so that I only needed 1 wire for supplying both sensors with power by connecting those to the + pin of the PIR; this is the red wire.

Now all the sensors were connected with each other in a way that when I would apply power to the PIR pins, the rest of the sensors would be powered as well.

Connecting the cable

As you can see a CAT5 cable was used; I only needed a total of 5 wires for this sensor. First I needed a way to glue the cable to the top cover of the enclosure; I saw there was some space between the PIR PCB and the top cover, so I what I did was remove the outer isolation on one half of the cable but left the other half intact. I added a drop of hot glue to it and quickly pushed it between the PCB and top cover, which made the cable isolation work like some sort of pull relief. Soldering the 5 wires was the last thing I did; cause now it was time to check some things first – does it work??

I wrote a small sketch that would read all the sensors once a second and display the results (do I hear a drum roll? ;-):

10765455 Motion:no,  Addr:28-98-C9-AF-2-0-0-A3 Temp=25.25 grC, LDR=643
10766546 Motion:no,  Addr:28-98-C9-AF-2-0-0-A3 Temp=25.25 grC, LDR=640
10767638 Motion:no,  Addr:28-98-C9-AF-2-0-0-A3 Temp=25.25 grC, LDR=640
10768730 Motion:no,  Addr:28-98-C9-AF-2-0-0-A3 Temp=25.25 grC, LDR=645
10769821 Motion:no,  Addr:28-98-C9-AF-2-0-0-A3 Temp=25.25 grC, LDR=653
10770913 Motion:no,  Addr:28-98-C9-AF-2-0-0-A3 Temp=25.25 grC, LDR=657
10772004 Motion:no,  Addr:28-98-C9-AF-2-0-0-A3 Temp=25.25 grC, LDR=663
10773096 Motion:no,  Addr:28-98-C9-AF-2-0-0-A3 Temp=25.25 grC, LDR=661
10774188 Motion:YES, Addr:28-98-C9-AF-2-0-0-A3 Temp=25.25 grC, LDR=666
10775279 Motion:YES, Addr:28-98-C9-AF-2-0-0-A3 Temp=25.25 grC, LDR=668
10776371 Motion:YES, Addr:28-98-C9-AF-2-0-0-A3 Temp=25.25 grC, LDR=663
10777462 Motion:YES, Addr:28-98-C9-AF-2-0-0-A3 Temp=25.25 grC, LDR=660

It works! Maybe I’ll put some drops of hot glue here and there to make it all slightly firmer and than I can close this sensor.

The sketch is still very basic; it’s just some Serial.prints you see here, no wireless transmission is done yet and there’s an ugly delay(1000) in the loop() for the 1-Wire delay that I have to get rid of.

And I don’t need temperature and light sent to me every second; but waiting one second before motion is detected is way too long of course. Using interrupts for detecting motion is better I guess… soon I’ll know more about that, cause I need to be able to handle 4 PIRs (on 4 different input pins), but I can’t have 4 ISRs (Interrupt Service Routines); but the ‘solution’ will probably suffice. Sounds like a nice subject for another post.

Tagged , . Bookmark the permalink.

8 Responses to First sensor finished and working

  1. Jeroen Cornelissen says:

    Hoi Robert,

    You can write 1 ISR and in the ISR you check which interrupt flag (corresponding to an interrupt pin) is set.

    On this photo it is nice to see actually how small the enclosure is. Very small!

  2. Willem says:

    What’s the board you’re using for that?

  3. Harry says:

    Hi, do you send all the sensor data to a JeeNode?

  4. Harry says:

    Really nice! Why leave it hanging around 😉 i’m just starting with home automation and arduino. I hope i get the skills needed. It’s really nice to read your blog. Helps me a lot! Thanks!

  5. Dylantje says:

    Robert.
    Where do you left the data? [ in your domotica? ]
    With a cable, send to what?

    I do not understand what you do with this sensor?
    I’am looking for something like this, only than send with wifi.

    Is there a option to get this sketch?
    Thanks

    • Yes, via a cable to a Arduino Fio, from there with Zigbee to an Ethernet connected XBee (the Coordinator) and eventually ending up in in my Domotica system.
      With a cable to the Fio, through the air (Zigbee) and with Ethernet to my system.

      What I do with this sensor?? How about: detecting motion, measuring the temperature and the amount of daylight.
      I can’t find the original sketch anymore; it evolved to a multi-room Motion/Temperature/Daylight sensor sketch, but that project has never been 100% finished.

Leave a Reply

Your email address will not be published. Required fields are marked *