MicroControllers are fun

I am preparing for my participation in TeliaSonera M2M symposium and the Swedish TechDays. Since my focus is internet of things I am playing around with the Arduino and Microsoft Intelligent System Service. This took me way back to school and the old Motorola 6X000 controllers. Back then everything had to be burned onto a PROM. Today it is more or less a computer.

This post will serve as guide for anyone that want to replicate some of the stuff I am showing at the mentioned events. It wont dive into the details on the electronics nor will it discuss the underlying architecture and design.

The Ardunio is quite simple to get running. All you need is the Arduino Sketch Editor or the Visual Studio Plugin: Visual Micro. A little bit of C++ knowledge and a lot of cool electronics and you can get going. For me it was about getting three things running:

  • Temperature readings
  • Motor control
  • Bar code scanning (this i ended up faking)

The temperature reading took a while to get running. But there are a huge amount of libraries that you can reuse. For temperature I used the OneWire and DallasTemperature and after a few calculations on resistors I got it to run and reading the sensor data is easy:

image

For this scenario all the data was relayed through the surface serving as the vendor machine screen. To do this I added the CmdMessenger library which made it easy to send events back and forth. Basically you add handlers and send evens through a bus that manages all the communication required:

image

The C# Code uses a similar pattern:

image

A very simple and straight forward model that will make it easy to send events from Arduino to C# and back. In the end the board was up and running and the vendor machine UI successfully sent and received events all the way back to Azure.

WP_20141116_14_13_03_Pro

And as stated in the title. MicroControllers are fun. I just got accepted into the Windows For Devices preview and will replicate this on the Galileo board. When I do, I will write a series of posts with all the required details to build your own smart vending machine.