It gets dark here in Finland in the winter time. Like reaaally dark. As i'm writing this the sun rises at 09:44 (AM) and sunset is at 15:06 (03:06 PM). So it's pretty much dark all the time when i'm awake. I needed some automatic motion sensing lights and as always, the project got slightly out of hand...
The lobby in my apartment has ceiling lights, but those are too bright to be user at the night time. And I would like the lobby to be lighted depending on which door i was entering from.
I started to manufacture the first prototype boards using the Tampere Hacklab CNC router. First pcb carving tests were done with a 45 degree 0.2mm v-bit but I decided to go with the 0.5mm v-bit because I had to do seven boards. The traces were a bit narrow after the milling but the boards we milled quickly. If the narrow traces raises resistance issues I can always do the prototype boards again. A good thing with local manufacturing...
The G-Codes for the milling were produced using the "pcb-gcode"-"user language program" in Eagle. I tried to import the gerber files into the milling software but I could not get it to work. The G-Codes from the "pcb-gcode"-software worked nicely. I used the "single-pass" setting which helped with the milling speed, without the setting the mill would clean the milled areas a bit too precisely costing too much time.
Seven boards were produced in the course of the week and I finished the drilling and component soldering for all of the boards. The soldering isn't that precise but gets the job done. I'm planning to order the proper boards from a "pcb-factory" so I can get the boards double sided and with silk screens. But while I'm in prototype and testing phase this quality will do.
When I connected the first boards to the Ultrasonic sensor and led strip it was really difficult to remember which way the connectors were supposed to be plugged in. I ordered some new connectors from aliexpress so I'll switch the connectors to the production-version.
The ultrasonic-sensor holder height is now a bit taller, it seems that the wall produced some errors in the reading so I had to get the sensor a centimeter more away from the wall. Hopefully this helps, haven't tested it yet.
For this week (1/2016) I'm planning the following:
Finish the hardware installation
Light strips, wires between the control boards
Install the 25W power source (this needs to be upgraded)
Start working with the master-slave co-operation between the modules
one module sensor triggers the lights on other sensors
For the software the following features have been added:
- Parameters are saved to the EEPROM after new settings have been submitted through the settings-page
- I tried to add some ESP8266 power saving features with no luck (the module takes ~100mA all the time)
- Parameter to change the direction of the led light-up
- Added a test page to manually input Ultrasonic sensor "distance"-values
- Added some multiprosessing abilities with ElapsetMillis
- Added a pulsetimeout for the Ultrasonic Sensors "PulseIn"-command
The code is progressing nicely so I was ready to do a POC (Proof of concept). I modelled a bracket for the ultrasonic sensor so I could set it behind the floor trim. Printed out few test pieces and remodeled the bracket to fit the sensor. The bracket is working nicely, had to bend it a bit to get good readings from the sensor. The sensor initially was reading 6 centimeters, I think the horizontal trimming was the cause of the problem.
The POC is working. Still much work to be done but nothing seems impossible at this stage.
I created this project to Hackaday.io and typed in a small summary of project logs. The project seems to be very promissing so why not get the word out. The software version is at 0.71 and has the following features:
On The Air webupdate
I can flash the ESP8266 with a new firmware straight trought the web-interface
Settings-page for the variables
"Trigger minimum", "Trigger maximum", "Number of pixels", "Light up delay" variables can be changed from the web interface
Led strip now triggers if the measured distance is between the minimum and maximum. The led strip pixels are lit up sequentially using the delay value
It's now 2AM and I need my beauty sleep. Damn this is one exciting project, sorry for the hype. I'm just so happy that things are working and getting done.
I switched from programming to electrical schematic design to get a breather. Coding is not my flavor of nerdism. The schematic is designed with Eagle 7.5.0 freeware version. I know, I know, I could use a open source software, but the libraries for components are so easily available for the Eagle.
The schematic consists of:
WS2812B led strip connector
Voltage regulator for the 3.3V
Reset switch for the ESP
and the ESP8266 + some components
The schematic is not final, but at this stage I need to document the rough idea of the hardware when I still can remember it.
What the Hell. I think i'm in love with this module. I would like to shake the dudes or dudettes hand who designed this amazing piece of hardware. I got the ESP8266 to check the ultrasonic sensors data and paste it to a web page. This may seem like an easy job for most of you guys/girls but for my knowledge and skill level, this is huge. The testing software is at version 0.5 and the features are as follows:
Check the measurement data from the ultrasonic sensor
Create a web page where you can check the sensor distance data
Trigger at specific minimum distance and light up the led strip
Need sleep, but I want to continue coding.... aargh.
Took a few nights and days to get familiar with the ESP8266 module. The most annoying problem was that the firmware uploading stopped at random point. The fix was to change the USB-cable which I connected the FTDI-programmer to a shorter one. No more upload failures. The best uploader I found was the "Electodragon ESP8266 firmware flasher". But when I changed the usb cable the uploading from the Arduino IDE was also fixed. Hoorayy!
I'm using the arduino language so I can get things done quickly. At some point I might need to change to the LUA-language, but I can get some experience on the ESP8266 before the change. The Arduino examples are quite cool and with lots of features. For a small and inexpensive module the ESP8266 does lots of things. The Jeelabs ESP-link is really well done and shows the potential of the small module. I tested few basic blink programs and the module seems to be working.
I calculated the needed wires for the whole system. Because the electrical outlets are in the other end of the floor trim, the continous ledstrip + wire would be around 10 meters. 8 separate led strips and 6 ultrasonic sensor for the doorways. Each Ultrasonic sensor needs a separate trigger and echo line (quick googling to prove it), the led strip needs common GND, common +5V + a separate data line. In total I would need 22 separate wires to get all the data across to the arduino. I would need a big cable duct to keep all wires in and the setup would be prone to failure. Not a good idea...
The ESPs aren't that expensive and the "new" ESP-12E has all the needed GPIOs to get things working. I could setup one ESP + ultrasonic sensor + led strip as one module. The modules would only need +5V and GND if I added one 3.3 voltage regulator to each module. No idea if the ESP8266 is up for the task, but testing will prove it.
Took a few weeks but all the needed parts have arrived. Unfortunately I didn't get the 30 leds / meter led strip, I think someone messed up in the warehouse and shipped only the 60 leds /meter option. Or maybe they were out of stock... either way, this will do. As the WS2812B is an addressable led strip, i can just simply turn of every other led to get that 30 leds/meter effect.
I tested the led strip in the hallway with full power. The test led strip was only a 70 cm piece and with full power it lit up the whole corridor. I could just have one strip and use it to light up everything but that would be just too easy... and easy is boring. I don't want my projects to be boring.
Here's few pictures of my test setup. The 70cm piece of led strip draws a 5W of power and thats a lot of current. We will see how my setup will work when I need to have a around 10 meters continuous cable with led strip and wire with soldering. The resistance and current will be an issue. One solution is to have a separate wires for half of the led strips so that the led strip and soldering would not build up too much resistance...
I could just use one or two wall mounted motion sensors which would cover the whole lobby, but i want something more fancy. "Laser trap"-sensor would be cool but i didn't want to have a transmitter and a receiver on every door or doorway. I'm planning to use Ultrasonic sensor so that the transmitter and receiver are in the same location.
I measured and calculated the amount of doorways and floor trim i would light up and set sensors for. Floor trim amount is about 6,71 meters and doorways 8 pcs. For the lighting I will use WS2812B based RGB led strip so i can get a cool lightup-effect depending on which direction a person enters the lobby. 6,71 meters of 60 leds/meter led strip would need around 120W of power so I think i'll stick with the 30 leds/meter led strip.
I need to order the parts so i can get to testing.