Friday 10 April 2015

Smart Lock Part 1

After my previous post about the mechanics of the smart lock, I need to realize how to do the electronics stuff. I got the TI cc2530 chips, which are really low power Zigbee radio chips, perfect for the door lock because it running on batteries. My goal for the smart lock software:
1) Auto lock feature.
2) Motor current\feedback abnormally - detect when some things can go wrong and stop. For example if someone is holding the key in place and giving the radio the command to lock/unlock - the motor will get stuck. I want the chip to sense it and stop everything.
2) Alarms/Events when the door is opened at specific time/dates. 
3) OTA updates - I do not want to take the electronics apart each time I want to upgrade the software.
4) Really low power consumption - should work at least 6 months on 2 AA batteries keeping good response time to wireless commands (under one second).
5) Security - Zigbee got AES-128 in the network layer, also the door lock cluster in Zigbee got extra security features, so it should be fine.

It may not seems like it but implementing all of this on this is quite easy, because almost everything is implemented on the TI Z-Stack. Autolock? ADC feedback? All the Zigbee network layer and communication?  
Using the TI Z-Stack framework it should be quite easy, this part does not scares me for now.

On the Computer\Internet part, I connect another CC2530 with Zigbee Network Processor firmware which acting as a UART bridge between the PC\Raspberry PI and the Zigbee network.

Now for the PC software part. I found this project in github call zigbee4java.  Basically, its a java code thats let you easily interface with Zigbee devices over the cc2530 bridge. I forked it to my github and added partially the OTA and door lock cluster as they did not implemented it yet (still in development).

I started implementing some really basic web api for zigbee4java, but it will take ages to get things working, so in the meantime I searched for another solution and found openhab2 in GitHub. Openhab is a project that offer a solution to manage your smart home at the user level, meaning nice UI, schedules, scenes, groups mobile apps etc. In openhab2 issues I found this issue, and the integration they did between zigbee4java and openhab2. I plan to help this integration in order to use openhab2 solution instead of developing one on my own. Also, openhab2 is far away from a stable/beta release.. but when it finish it will be much better than anything I can program in decent time.

Also, my cc2530 pair got fried after supplying it with 5v instead of 3.3v.. so I am waiting for a new pair. Thats it for now, hope I can make some progress on this.

No comments:

Post a Comment