Notes about the pull-up

The motion sensor i finished yesterday needed some last tests; namely, what resistor should i use? Internal? External? And in the case of external, what value? Now the internal pull-up resistors of the Arduino are 20 k. But why not try to use a higher value, cause even with this resistor the rule V = I * R applies, right? When the JeeNode is in power down mode, i measure 1.36V over the external (100 k) resistor I used till now. That means there’s a current of 13.6 μA going through the resistor. With the internal 20k resistor this would be 5 times more: 68 μA! Yuck! And all that in power down mode, no way!

OK; i bought a huge case with an assortment of resistors a few years ago, ranging from 12Ω to 1 MΩ. Hey, let’s try that last one, 1 MΩ. This will add an additional factor of 10 to the external resistor value, resulting in the current dropping to 1.36 μA. And guess what; with this resistor the behavior of the PIR didn’t change; this is very nice! I hope I’m not overlooking or breaking any electrical laws or rules by doing this, but this seems the right thing to do..

Programming the XBee and placing it in the breakout board is all there’s left to do; I guess you could say this 3rd sensor is finished! 🙂

Last tests…

This evening I started building the first ELV PIR13 based motion sensor. Looking at the time right now, I think it took me 2.5 hours; during that time I soldered a JeeNode, attached a cable to the PIR13, soldered a XBee breakout board, soldered the wires to the JeeNode, drilled some holes in the enclosures,  … well here’s the result:

Almost finished

With each sensor that I build, it’s becoming less time consuming to build the hardware. With the sketch compiled and uploaded in debug mode, i wanted to see if everything was working OK, and it did. One last thing has to be resolved before i can move this sensor to it’s final location, and that’s if I can enable the internal pull-up on the interrupt pin. I probably can,  but maybe that’s not such a good idea. I mean, a pull-up resistor consumes power, so it matters if it’s 100 Ω or 100 kΩ, right? What if the resistor can have a higher resistance (and the PIR still working well) than the internal pull-up? Would that save me energy? And how much? An issue to spend the next evening with, cause this is all to new for me to decide based on experience or knowledge…

So that’s why i added a header on JeeNode port 2 (click the image and you’ll get a more detailed view) and put a resistor in there, between P and I; so I don’t have to rely on the internal pull-up if I don’t want to but can also discard that external resistor – based on what I think is best based on my findings.

PIR13 Motion sketch progressing

Although i came home rather late this evening, i had about an hour left to proceed with the ELV PIR13-based motion sensor.  Let’s see if I can get the PIR13 working on an interrupt pin…

I took the sketch from motion sensor v2 as a start, changed some minor things and uploaded the sketch to the JeeNode. Bummer, I forgot that now the PIR13 output pin is attached to an interrupt pin, there’s no more internal pull-up enabled. That’s why the thing isn’t working! Adding an external resistor between + and the PIR output solved this as you can see by looking at the output:

[Motion_PIR13]
0
1
0
1
1
0
0
0
etc....

The changes that had to be made to the sketch to get the PIR13 running were minimal, so I will change the Motion v2 sketch in a way that it can be used with the Panasonic PIR as well as the PIR13; just to keep the number of sketches used to a minimum.

A new challenge

First a follow-up on yesterday’s TV LED strips; here’s what it looks like a few hour later, around 22:30, while I was watching “24”. One of the few things left that make me sit down, watch and enjoy live TV.

LED strips in the evening

I know; I’m not much of a photographer, but I tried to make it look as best as I could. In real life it looks even better 🙂 OK, this one is finished; on to the next challenge!

Which means back to the motion sensor, the ELV PIR13 i bought recently.

Testing ELV PIR13

After i cleaned the desks, I connected a PIR13 to a JeeNode and uploaded a sketch i used for the Panasonic PIR before. No luck this time; nothing but garbage coming from the PIR.

A digitalRead() produced nothing useful and i didn’t understand why. I tried adding resistors between GND and the PIR output, but that wasn’t succesful either. But somehow i knew i was close…then I remembered reading about internal pullup concerning the PIR13 somewhere, so I added an additional digitalWrite() in the setup routine to enable them. Bingo, now i get the right results!

Now the digitalRead calls produce a ‘low’ when motion is detected and ‘high’ when not. That’s something I can work with. For now this ELV PIR13 will remain on my desk for a while untill I can find some time to solder a new JeeNode, buy some more XBee modules and enclosures, plugs and stuff, cause I’m running out of stock…

Lamp replaced by "DIY Ambilight"

LED strips

Even in full daylight and the LED strips @ 50%, this already looks VERY OK to me! Can’t wait till it’s dark outside..

After some small tests during the last couple of weeks, it was time to finish replacing a lamp near the TV with LED lighting. It’s still a big cable mess in the corner where the TV is located, but you can’t start cleaning up when you’re not finished, right? A lamp, holding 2 energy saving light bulbs, consuming 11W, has now been replaced by LED strips attached to the back of the TV. I call it my “DIY ambilight” project 🙂

The following components were used:

  • 1 x JeeNode v4;
  • 2 x MOSFET Plug;
  • 3 meters of warm white LED strip;
  • XBee series 2 module;
  • XBee breakout board;
  • 3.5 mm mono plugs;
  • 12V power supply.

And 3 x software; 1 for my Home Automation system, 1 for the JeeNode and 1 for the Touchscreen. The Pronto will follow soon.

From my Home Automation system i can control each of the 4 segments individually; i created a new device type and when i send a “L=30” command to this device, the LED strip on the left of the TV goes to 30%. When i send a “B=0“, the bottom LED strip goes to 0%. A “*=10” will result in all 4 LED strips to go to 10%.

The hardware (power supply, JeeNode, LED strips) is controlled by a PLCBUS appliance module, so when it’s time to go to bed, i don’t have to worry about additional standby power usage.

On the Touchscreen i added a popup form so i can change the settings of the LED strips:

TV LED control

Although I’m technically able to, i didn’t put 4 trackbar controls on this form to control each LED segment individually. The reason for that is that I don’t think it will ever be used by anyone else but myself. I think, in daily practice, these 4 LED strips will only be switched on and off, once a brightness level has been set that suits the ligthing in the rest of the living room.

The sketch that is running on the JeeNode is pretty straight forward, once you’ve seen Jean Claude Wipplers sketch to control RGB strips. I think it’s needless to say that without his hardware, software and sharing of knowledge, i would probably still be watching blinking LEDs… well, sort of 🙂

Well, anyway, here it is.

Curious about how the back side of the TV looks right now? Here you can see where the LED strips are attached to the back side of the TV and where i placed the 12V adapter and the enclosure that holds the MOSFET plugs, JeeNode and XBee.

Once i had it all (more or less) figured out, it took me 2 afternoons to go from a cardboard test setup to what it is now. Based on the response from wife and children, this is the best thing that has happened since the introduction of the touchscreen. Which I implemented 18 months ago… 😕 And what has happened to that $$$ Roomba???

Update:

Power consumption? The LED strips provide enough light @ 16%, resulting in a total of 2W power usage. Not bad!

Movee

Making a video takes too much time; I do have a DV cam, but in my opinion it takes to long to rewind, connect the firewire cable, transfer the clip to the PC etc. etc. My Nikon D90 also has video capabilities, but I’ve used it maybe once or twice in the beginning. The D90 can shoot 1280×720@24 fps MJPEG movies. I used it a couple of times again while we were on holiday and the results were quite good; although i still prefer my DV cam: focusing is slow and a bit difficult with the D90.

Here’s a small clip of my test with a JeeNode and 4 LED strip remainders i still had from my kitchen LED adventure.

A boxed PIR13

Two PIR13’s arrived yesterday. I immediately unpacked them to see if they would fit in the enclosure I want to use for them. It fits, but there’s not much room for error.

The lens is larger than the one on the previous PIR I used; this one requires a 13 mm hole, the previous was 10 mm. And the PIR13 lens sticks out more then the Panasonic version. But still, i prefer this much more than the X10-RF motion sensors i used in my former life 🙂

The PIR13 PCB is glued to the top plate with hot glue. As you can see there’s not much tolerance along the long sides of the PCB; if the hole through the top plate is a bit excentric, you’ll have a hard time to make it all fit right. So pay attention there!

One nasty thing happened to me while preparing the 1st PIR13 to fit in the box; i decided it was wise to get rid of the 3 headers that are sticking out of the PCB; they were much to long! So i took my soldering iron and tried to get those things out. Normally, when you remove the plastic piece of the header and hold the soldering iron against a pin, they automatically fall out, sometimes with a bit of help, or they stick to the soldering iron. This time it was different; as if the pins were rammed into the PCB with a hammer! So i used a pair of pliers to gently pull the pin out; and while doing that, i damaged the PCB in a way that can’t be repaired anymore; aarggh!! First a voltage regulator blown up, now this.. what is this??

With the 2nd PIR13, i just cut off half of the pin length…

I foresee a “battle” for my spare time, between the LED strips and this new motion sensor… 🙂

JeeNode+12V = Oops!!!

Last weekend i was working on one of those things where i started collecting components a long time ago but that still wasn’t finished. Time to finally use these 4 meters of LED strip!

Warm white LED strip

With this warm white LED strip i want to create my own lighting in the corner where our TV is mounted to the wall. The strips will be put on the back side of the TV, shining on the (white) wall. I’m not really into RGB strips; it’s nice to see (for a while), but it’s to colorful for my taste.

I’m going to use a JeeNode with 2 MOSFET plugs to control the 4 segments:

JeeNode and MOSFET plugs

All wirelessly controllable by the use of an XBee module of course; a new page on my Pronto TSU 9600 with a couple of sliders (like on the picture below) to control these 4 segments individually will do the rest:

Pronto sliders

But while i was trying to create some sort of experimental setup with 4 small pieces of LED strip on a piece of cardboard, something went  terribly wrong; somehow the wires of the 12V LED adapter made contact with something that couldn’t handle this amount of power: Poofff !! One voltage regulator blown to pieces. I don’t know how this could go wrong, cause I didn’t do this, it just happened!

VR fried

Well, this JeeNode doesn’t work anymore…

OK. Fortunately I had another unused JeeNode laying around so i could finish the test (it works brilliantly), but what to do with this JeeNode? Replace the VR (the only component with visual damage) or discard the whole JeeNode cause there will probably be more components that suffered from this? I don’t know; I’m the type of guy that didn’t even know what a pull-up resistor was a year ago, so I’ve got no clue 🙁

First I’ll finish this TV LED project and when I’m almost running out of JeeNodes in the future, I’ll give this damaged one a try…

It all comes together

Today we received the iRobot’s Roomba vacuuming robot. This robot will help us to keep the dust level on the floor at an acceptable level.

iRobot Roomba

Integrating this robot into my Domotica system is a good example of how easy it can be to integrate a new type of Device into a Domotica system that works and is built like i think it should 🙂

Do i want to use the iRobot remote control? No, of course not; those things can get lost and it doesn’t bring integration! I have an IRTrans for Infrared controlled devices. So the first thing to do was finding the right IR codes for the Roomba. That wasn’t too hard. I created a .rem file for the IRTrans server and saw I could give the Roomba the CLEAN command.

Actually, that was the hardest part. Next thing I did was add a button on the touchscreen in the livingroom to manually control the Roomba from there. Drag & drop a button, a combobox and write 1 line of VB code:

Touchscreen finished; next! My Domotica system. This one needed a restart cause i had to add a new Device Class:

unit Roomba563;

interface

uses
 IRControlledDevice;

type
 TRoomba563 = class(TIRControlledDevice)
   constructor Create(const AAddress,AphDeviceID,ALocation,ADescription:String); override;
 end;

implementation

uses
 Windows, Utils,
 DeviceTypes;

constructor TRoomba563.Create;
begin
  inherited Create(AAddress, APHDeviceID, ALocation, ADescription);
  SubDelay:=100; //msec
end;

initialization

 OutputDebugString('Init Unit Roomba563');
 gclDeviceClasses.Add(TRoomba563);

end.

Copy, Paste, Replace All, Save, Compile, Done! Virtually no “real” additional code needed, no adjustments to existing code; it all works perfectly together. It’s just another type of device…

Now, this Roomba makes too much noise to have it driving around in the same room as where you are, so there are 2 options: let the Roomba do the cleaning at night or while everybody’s away.

So now I’ve got one thing left to do: create 2 new events so that a status change of the alarm system will trigger either a CLEAN or a DOCK command, so that the Roomba will start cleaning while we’re away but also obediently return to its base station when we get back home. That’s about 6 records (rows) that need to be added to the database.

Done!  I love it when a plan comes together 🙂

Going down even more

Now that i have no more PIR sensors in stock, I had to find me an alternative. The requirements: low power of course, it should be able to fit in the PIR enclosure i already have in use and not too expensive, cause I’ll need a lot of them. The ELV PIR13 seems to be the right candidate for the job; this would bring down the PIR power usage from 170 µA to 40 µA. I don’t have to tell you what that will do to battery life 🙂

ELV PIR13: PCB 25 x 37 mm, 13 mm PIR

I’ve ordered a couple of these ELV PIR13’s and will build a 3rd motion sensor with one of these. In the meantime I also changed some things in the code to reduce the JeeNode power usage in power down mode even more: it went down from 20 µA to 6.5 µA. Calculations show a theoretical battery life of 200 weeks… well, i think the internal discharge will have screwed up the battery before that…

BTW, the 2 motion sensors that are currently being used, are still running fine on their first set of batteries.