Post on 29-Jun-2015
description
How I Built My Own Irrigation Controller
Talk Outline for DroidCon 2014
Background
• Wearables & IOT are huge– Huge opportunity for connecting all sorts of
devices– Much of the hype is around glasses and watches• Appliances are slowly picking up• Emerging standards, e.g. AllSeen
• The maker revolution lets everyone play a role in this
My Own Journey
• Bitten by the maker revolution a couple of years ago– Explored Arduino, MSP430, Raspberry PI &
BeagleBone• Made an irrigation controller with off-the shelf
components first– AC operated, Water at specific times of day– Many shortcomings
• Soon, pushed myself to make this a product
I am Here Now !
Battery Operated
(10 years + life)
LCD Display with Backlight
User Buttons
Bluetooth (Classic)
Shell being finalized… - will be “unvelied” in the conference
Design Parameters
• Battery operated, long life• Least cost device• Easy to produce in small quantities• Controllable easily, and via other devices– Users must not need a new phone
Design Choices
• Low power TI MSP430 for device processor• Latching valve for max battery life• Nokia 5110 LCD, 2 user button• Bluetooth Serial connectivity– future path to Bluetooth LE
TI MSP430 Microcontroller
• Microcontroller family– MSP430G2553 used in this project
• 512 bytes of RAM, 16 KB flash. (Yes, that’s BYTES)
• Low Power – Sleep current < 1 uA– Years of battery life, limited by self discharge.
• Easy to get started– Simple and intutive hardware design
Bluetooth Serial
• Serial Interface over Bluetooth• Trivial to implement on Android & elsewhere• Low cost modules available – e.g. JY-MCU• But don’t use your regular serial protocol– \r\n based protocols store the whole line in
memory– RAM is the most precious resource
Protocol Design
• Character Based• App sends a byte of data• Device processes and outputs– Same byte if OK– Error byte on bad character
• App terminates command with \r\n• Packet based format for device response• Ease of use over serial terminal• RAM requirement
Examples
Turn ON valveApp Device Comments
O O
\r \r
\n \n
0,3,S 3 bytes in response. S represents success
Set Timer
App Device Comments
aHHMMSShhmmssNNN
aHHMMSShhmmssNNN
NNN is repeat duration in days
\r \r
\r \n
0,5,S,0,7 5 bytes in response. 07 is the timer ID
Protocol Implementation
• Protocol supports– Version identification– Add, modify, remove timers– Get/set current time– Direct valve control– Firmware update is TBD
• Implemented in a single source file• Open Source (will be)– Users can make their own apps– BT exposes extra controls
Bluetooth Based User Control
• Widely usable Android App • App provides common functions– Richer UI than possible on the LCD
• App can sync with the device– Statistics
• BT consumes lot of power– Device can turn BT ON periodically to help sync
with app– Low RTC drift aids sync
Steps Along the Way
• Making a device is a lot of work!• Schematics for Electronics • Board Design, Fabrication, Board Assembly• Software Development, Debugging, Reliability• Enclosure Design• And I haven’t even spoken about actual
production!
Open Source Tools
• KiCAD for PCB schematics, layout, gerber generation, and even cool 3D views
Open Source Tools
• FreeCAD for mechanical assembly…
< Picture Placeholder >
Conclusion
• Connected devices will be all around us soon• You can create them with reasonable effort,
and low capital• The Maker Revolution puts all the right tools
in your hand• So, go build the future!