I’ve wanted to schedule the easier things to later; and after the pir/pwm came the tasks i assumed are easier. Connecting a standard ir reciever is not much an issue - usually; but no matter how i tried it, it just didnt work. I’ve kept circling after a while: check connection, check datasheet, check program, use different (remote/ir reciever/pin). I’ve even checked that the ir receiver works ysing an arduino uno… After 2 wasted evenings…i’ve started feeling the datasheet i was using: a bit wierd…the first datasheet google throw me back(google search for:tsop4838); was a ‘family datasheet’(first hit)…and it contained working conditions of the family as a whole my biggest problem was that my Tsop4838 needed minimum 4.5v to work…but this family sheet said it works from 2.5v….
After the pir ride i’ve added the dht - that worked without any issues; the biggest problem was that i was sure i’ve connected it to gpio4…and in reality it was connected to 5…I now have large ESP12E module layout printed out - this will probably prevent mistakes like this. The fet needs pwm control…so I wanted to continue with that. Wiring it up was not much an issue. At first i’ve used the analogwrite function to pwm control the fet - after some loose wire issues I was able to do it….
I wanted to start moving my hardware features to the esp prototype… baby steps? I wanted to start with something simple…the PIR sensor is either gives signal or not - that’s simple enough ;) Because I want my new board to be pure 3.3v based - i had some issues that the sensor didn’t wanted to work with 3.3v. However…it turned out; that the board is in fact 3.3v based - and I’ve used a trick to skip the hc-sr501 ’s on-board regulator.
I’ve finished my planned home automation device’s prototype around 2-3 weeks ago…but it looked like I will almost sure will run out of flash space - and will loose ota update capability. While I was evaluating my options someone on #arduino have talked about an issue he is having with an esp…and it turned out that thing has more potential for me than I earlier thinked…I’ve already had an esp01 module in my ‘possibly usefull stuffs’ storage.
Original plan: create schemantic I’ve met with one of my friend who does have degree in Electrical Engineering ;) And i’ve wanted to ask him to check my circuits…he asked for schemantics - and because the only “real” existing schemantic was already built… I’ve looked for a schemantic drawing tool before - but I’ve failed to find the right one for me. I was very fortunate that I’ve subscribe to ForceTronics on youtube earlier (he makes very good videos in home automation topics…gives a very good presentation about what he is talking about), and I’ve got a notification that he have just published a video about EasyEDA - i’ve considered easyeda before; but around that time it looked a bit too complicated.
I’ve forgot to write about this…so I try to write my memories before I forgot this ;) Day 0 I’ve placed all devices and cables where they should be…check that it works and unpluged it for the night. Day 1 In the morining I’ve showed it to my wife: that it’s now working ;) I’ve showed my wife the most important thing of the new kitchen lightning system… there is only one plug where it gets all the electricity…in case something is not right (catches fire…or gives wierd noises) she should be able to neutralize it without having to track down the cables - and I’ve encouraged she to do so If she thinks its needed.
I was able to disable the nrf autoack feature; it is strange why I have to enable autoack prior to disabling it….but it looks like these modules like it this way ;) I’ve noticed a weak soldering in the sensor device - i’ve tried to fix it (without soldering) ; it went well enough to finish the current measurement for sizing the fuse; but its another minor showstopper ;) Next day or so I’ve added a diode and a 200mA polyfuse to the led driver board; to create some protecton for these circuits.
Lately i’ve finished the ota related software components…its still ugly; but at least it now uploads & swaps the new firmware with a success rate of around ~90%…sometimes the mega messes something up; and avrdude timeouts…but its fine for me for now at least. There were a very strange problem…sometimes the otad behaved strangely or just seemingly lost contact with the mega….it took for me a while to realize that i might be facing some memory issues; fixing all valgrind errors and warnings uncovered that i’ve forgot to initialize a buffer offset variable…I should definetly turn on -Werror and its friends… I will record a video about it - to show how cool it is to have all these devices accessible from eclipsearduino thru the ota infrastructure ;) Having almost everything ready for preliminary deployment…i went forward to add the base functionalities for the devices; cleaned up some apis a bit - and fixed issues which almost entirely prohibited normal operations - i’ve made a choice of duplicating the some parts of the rx/tx channel methods…this decision have kicked back a few times already..
I’ve already evaluated what i would really need to protect my comms from 3rd parties; but i still miss the stream alike controllers on both ends to maintain the channels between the devices. remote writing (arduino – arduino) With the local self writing capability ready for use, i started adding some sequence based retrasmission capable stuff (i wasnt sure where i will end up with it eventually)… After creating the prototype for a single one directional channel I was surprised that the encryption part will just fit into the playfield by adding it behind the seq handler later on.
Earlier i’ve found the optiboot project, which looked like a great candidate to reshape into the key instrument to enable remote firmware upgrades for the pro minis. The idea is to have the flash split logicaally in two: first section running the current firmware second section is reserved for the new firmware The bootloader is the only “trusted” part of the flash from within flash write commands are accepted. So: i will add an upgrade service to the bootloader to provide the flash programming feature to the main application.
Moving the existing breadboard application to a soldered one was easier than before…the hardest was to find a suitable timeframe when I can start working on it. drilling holes I’ve ordered a small box earlier(and was hanging around without any purpose); because I don’t really had strict size contrains or ergonomical requirements for it - I decided to use it. I decided to use 3 dc jacks to connect: the upstream ac/dc converter the other arduinos power the controlled led strip I’ve ordered some pcb mountable plugs..
During the last week I was able to build the breadboard version of the kitchen2 device. Learning from my previous problems with just partially prototyping the circuit. I’ve built it fully …i’ve connected the “production” power supply to it and the ledstrip too. The led strip is dimmed by a fet…because this was new for me I’ve consulted with some experts on the arduino irc channel about what i want to build and they have taught me the simplest cases of using Fets: Fet is under pwm control?
I’ve been struggling with it for days now…maybe if I write it down, it gets a clearer picture for me too ;) So…I will have multiple devices with the ability to communicate to each-other via radio. Possible challenges/problems: the system itself should be able to withstand partial crash of the infrastructure…so in case of catastrophic failure; all functioning parts should sustain their function as much as possible. this means that the control logic will be distributed and the nodes should behave in a mesh network like manner it might be possible that the RF24 modules would need multiple hops to reach the target this might not be the case, I will check this fact later - having a real mesh network is cool, but in case I dont need it at all… unauthorized 3rdparties should not interfere with the operation of the system communication protocol must be resilient to replay attacks I can’t do anything to prevent an adversary to flood the radio channels with noise… the nrf’s design is very limited…1 channel out; 5 channel in.
Creating the box After fixing the power related issue I encountered…I designed a box for the device; which could be 3d printed. I’ve started working with some nightly FreeCad version (v0.16) - I ended up using a the nightly version because I encountered some issue with its spreadsheet usage - I worked a lot to be able to enter all my data thru the spreadsheet page. So later I can come back, and this way I don’t have to be absolutely right at the first time - just change the parameter and I’m done - at least that’s the idea…FreeCad is designed for heavy use of constraint based modelling - it takes a lot of effort do design things in it.
I’ve ordered a bunch of capacitators and other gadets…to fix the problem. After my order arrived…i’ve moved the stepdown module to a prototyping board; and wired it up from there. I wanted the check that the problem still exists: so i didn’t added any capacitator…and for my biggest surprise: it worked. I thinked that: because of the different conditions…longer cabels…the noise is not that close to the other parts. I added the capacitators to the proto board…that went well to… I soldered 100uF capacitators under the stepdown…I was happy that I have enough space to put them in…I added one for the input and one for the output..just in case.
Last week all needed parts arrived to start with the assembly of the first member of my home automation infrastructure. This will be the kitchen sensor - i picked this because it involves many sensors and no control. Imagined operation If i walk into the kitchen…it should be aware of my presence; if the light condition are too dim - the two lamps should turn on…to supplement lighting to the specified level.
I’ve a max471 based voltage/current measurement module from ebay. It’s very straightforward to use it…snap in, measure the 2 AD outputs. But on my desk I power the arduino appliances driectly from usb. And for some reason, I only got 4.6 or 4.7 volts(i’m using some cheap hub). But having lower voltage does matter in this case, because the max471 communicates in analog form. I’ve tried this module earlier and I concluded that the max471 is precise; and works up to specs returning analog values - but I’m not really able to read the correct value; because of the lower VCC voltage.
I’ve tested the nrf24l01 modules on my table…and after they begin to work; I wanted to check that how far I can communicate with it – I wanted to know that I must add mesh tech to things thing or not. I have a bunch of 18650 batteries; with 3-pack battery holders. I estimated the voltage from that to be ~12.6. so I opened up the pro mini info page…even thru they wrote that 12v is the maximal voltage; I tried to open regulator’s(S80E) datasheet…my search pulled up a lot of garbage without results…so i tried to lookup what kind of regulators are on the pro mini-s…i found some pointers in a forum…and finally opened the datasheet - I quickly determined that the regulator is rated to handle up to 16V :) …so i connected the battery pack.
Our living room and kitchen is in the same space; they are separated by a half-wall. We have a table in the kitchen; with a smaller tablepiece over it…I wanted to install a led strip under the upper one. I’ve bought the led strip…the power supply for it..and then I was unable to install them; because I would need to replace the existing switch with another one…which is already at a bad position…and because I forgot to buy a box for the 220v parts i needed to install - the whole idea got stuck because of implementation problems.