As a long-time .Net and Visual Studio fan, I was immensely excited when I discovered the original Netduino - finally I could use the same IDE I develop software with all day long for my hardware projects! I somehow got distracted with a million other boards along the way, but this contest allowed me to rekindle my love for the .Net Micro Framework - this time re-imagining a project I'd created back on the original device which allowed me to control a radio control car via a PC - but now with added IoT goodness thanks to the networking capabilities of the Netduino 3 Ethernet! ๐ฎ๐๏ธ
Development Process ๐ช ๐ปThe first step in my project was tearing down the KT-18 controller from my Mini-Z in order to replace the potentiometers that are used in the steering wheel and throttle trigger with a DS1803 Addressable Dual Digital Potentiometer, allowing me to emulate their positions digitally. I connected the DS1803
to the Netduino's SDA
and SCL
pins in order to communicate with it via I2C
. I then refactored to create a DS1803
object for better abstraction from my main Program.cs
.
With the digital potentiometer functional, my next step was to IoT-ify everything! The Netduino Getting Started guide includes a section on Networking which was a helpful overview, but I ran into a lot of problems getting networking...working! ๐ It wasn't until I discovered the RgbLedHost example that I managed to get a cohesive web server functioning, and as a bonus I discovered how to use event-based functions as an interface between classes.
With a basic web server in place, I was then able to flesh out a RESTful API with endpoints to control various steering and throttle functions.
The full source can be found here:
https://github.com/ishotjr/IoRCT
and if you work through the individual commits, you can see how it all came together (eventually!):
https://github.com/ishotjr/IoRCT/commits/master
Steps to Repro ๐ ๐To recreate this project, simply connect the Netduino 3 and DS1803
via I2C (don't forget pull-ups!), and the RC controller potentiometers to the DS1803
, then clone the GitHub repo and build IoRCT.sln
. Deployment instructions can be found in the Getting Started guide.
This project ended up taking much, much longer than anticipated - I'd expected to be able to just sprinkle networking over the I2C functionality, but it turned out to be extremely finicky and I spent several solid days just trying to figure out why networking was failing. I suppose that made my victory over the problems I encountered even sweeter in the end! ๐
Next Steps/Future Enhancements ๐ ๐ฎI'd hoped to build a cool client for the API, such as a Pebble watchapp, but I spent so much time wrangling networking that this was not possible. I'd also like to extend the number of API endpoints to include more "sequences" like the existing "circle" functionality. I guess the ultimate success would be pre-programming an entire track - or adding a real-time camera to the car that streams to a web view to allow an "on-board" driving experience! ๐คฉ
Comments