Arduino Smart Watering Kit with Azure IoT Central

I came across this Smart Watering Kit by Elecrow. It was really great, but one thing missing is internet conectivity. We all know that we can’t grow plants without the “I” in IoT! So let’s see what we can do about that!

Electrow Ardunio Smart Plant Watering Kit
Inside the box

The kit comes with everything you need to water four different plants automatically.

The box contains

  • Arduino Leonardo
  • Power Supply
  • Pump
  • 4 Capacitive Moisture Sensors
  • 4 Way valves
  • Pipes

The kit is very comprensive and includes and LCD display which can show at a glance the conditions of your plants.

The board
Serial Port

The board unfortunately does not have built in wifi connectivity. But what it does have is a serial port. That’s perfect, so what we could do is use that to send telemetry out to another device that is internet / wifi enabled.

A good device for that is a good old (and cheap) 8266 board. I had a NodeMCU in my box of tricks, so I decided to use that.

Parts List

  • Arduino Smart Watering Board (Arduino Leonardo)
  • NodeMCU board
  • 2.2 K ohm resistor
  • 1 K ohm Resistor
  • 470 ohm Resistor
  • Breadboard
  • Wires
  • Power Supply

Connecting an Arduino Leonardo to a Node MCU via Serial Port

First step is to make it work on a breadboard.

Parts List

  • Arduino Smart Watering Board (Arduino Leonardo)
  • NodeMCU board
  • 2.2 K ohm resistor
  • 1 K ohm Resistor
  • 470 ohm Resistor
  • Veroboard
  • Wires
  • Power Supply
Connecting an Arduino Leonardo to a Node MCU via Serial Port

Once working, the next step is to build that onto a more permanent solution. I decided to use just veroboard as it was quick and easy.

Two boards up and running

IoT Central

Device Templates

Device Capabilities

Create device capabilities for the moisture sensors as telemetry (Moisture1, Moisture2, Moisture3, Moisture4). [Device Definition json file is in the github repository along with the source code]

Create properties for the 4 relay states for each of the 4 valves. [Device Definition json file is in the github repository along with the source code]

Create a property for the pump state. [Device Definition json file is in the github repository along with the source code]

Publish the template and create an instance of the template as a device.

Instance of a device template

Note the “connection” information for the new device instance.

Device “Connection” information

Take note of the following:

  • Scope ID
  • Device ID
  • Primary Key
iotcserialrelay.ino

Update the iotcserialrelay.ino file with the:

  • WIFI_SSID – The wifi hotspot ssid
  • WIFI_PASSWORD – The wifi hotspot password
  • SCOPE_ID – The Device Instance’s Scope Id
  • DEVICE_ID – The Device Instance’s Device Id
  • DEVICE_KEY 0 The Device Instance’s Key

Deploy iotcserialrelay.ino to NodeMCU.

Deploy watering_kit.ino to the Arduio Smart Watering Board.

Telemetry in IoT Central

Once deployed and connection is made, telemetry starts appearing within IoT Central’s dashboard.

Finished Product with happy plants powered by Microsoft Azure 😎😎

Source code: https://github.com/apead/SmartWateringKit

Product Information: https://www.elecrow.com/arduino-automatic-smart-plant-watering-kit.html

Where to buy? https://www.robotics.org.za/AAK90039K

Azure and the Internet of Things at GXUGSA

Always fun to fly to Johannesburg and speak at GXUGSA.    I hope it was useful.

I’ve made all content available.

 

Event:  https://www.meetup.com/Gauteng-Xamarin-User-Group/events/241783761/

 

Presentation:   https://github.com/apead/XUGSA/tree/master/12092017

 

Android Things Weatherstation (Android Studio):   https://github.com/androidthings/weatherstation

 

Android Things Weatherstation (Xamarin):   https://github.com/apead/Xamarin-AndroidThings-Contrib

 

MX Chip kit Twitter Shake-Shake:  https://microsoft.github.io/azure-iot-developer-kit/docs/projects/shake-shake/

 

MX Chip orders available from DFRobot:  https://www.dfrobot.com/product-1616.html

 

This session featured

 

Azure Functions

Azure Iot Hub

Azure Stream Analytics

Azure Machine Learning

Power BI

Android Things

MX Chip Azure Iot Kit

And other Iot platforms and devices (Arduino, Netduino, Raspberry Pi, Windows 10 Iot, Xamarin Iot)

 

MXChip Iot Kit

 

IoT at GXUGSA

Happy Cross Platform IoT’ing

 

Azure Cape Town – Azure and the Internet of Things

Last night was a fun evening of Azure Iot at the Azure Cape Town user group.   Thanks to all for coming, I hope it was useful.   The turnout was awesome!

 

I’ve made all content available.

 

Presentation:   https://github.com/apead/XUGSA/tree/master/12092017

 

Android Things Weatherstation (Android Studio):   https://github.com/androidthings/weatherstation

 

Android Things Weatherstation (Xamarin):   https://github.com/apead/Xamarin-AndroidThings-Contrib

 

MX Chip kit Twitter Shake-Shake:  https://microsoft.github.io/azure-iot-developer-kit/docs/projects/shake-shake/

 

This session featured

 

Azure Functions

Azure Iot Hub

Azure Stream Analytics

Azure Machine Learning

Android Things

MX Chip Azure Iot Kit

And other Iot platforms and devices (Arduino, Netduino, Raspberry Pi, Windows 10 Iot, Xamarin Iot)

 

 

More Devices!

 

Weatherstation

 

Happy Iot’ing!

Visual Studio: The one IDE to rule them all

This week there was some great news about .NET MF and the return of the Netduino!(http://blog.wildernesslabs.co/netduino-is-back/)

 

I was inspired enough to dust off one of my older projects which included .NET MF and the Xamarin Monkey Robotics project. I then decided to consolidate and rearrange it with some of the newer stuff I’m playing with in the “Iot” space.    It’s also an example of how Visual Studio can handle projects of all types, held together and fully “debuggable” within one solution.     This seems like a good time to do this especially with the recent talks at the Xamarin User Groups in Cape Town (http://explorationspace.co.za/2017/07/20/cross-platform-iot-at-ctxug/)  and Johannesburg (http://explorationspace.co.za/2017/07/12/cross-platform-iot-at-gxugsa/) on the topic.

 

 

Visual Studio Controller of Things Solution

 

I do still have to port all this to Visual Studio 15.3 preview 3 so I can have Xamarin Iot working in the solution as well.

 

Still a lot of on the list to do today, so I’ll end off here.

 

Happy Iot’ing!

Cross Platform Iot at CTXUG

Last night was the Cross Platform Iot Session at CTXUG in Cape Town.    The turnout was absolutely amazing!    Thank you to all for coming it was a really fun evening!

 

Roger Weiss from Aliens kicked off with an overview of Windows 10 Iot Core and a few demos.  These demos featured some awesome use of Microsoft Cognitive services and also some nifty voice controlled home automation.

 

It was then my turn.   Unfortunately Chris van Wyk couldn’t make it this evening.  🙁

 

The session featured

 

Visual Micro for Visual Studio

Visual Studio Code with Arduino Extension which is now Open Source.

Xamarin Forms and Xamarin.Android with Android Things 0.41 Preview

The new Xamarin Iot preview for Linux based devices

Azure Iot Hubs

 

Devices wise 

 

Raspberry Pi 3

Intel Edison

Raspberry Pi Zero W

Latte Panda and Arduino Leonardo

MXChip Azure Kit

Devices everywhere! Latte Panda, Pi With Android Things. NexDock

 

The awesome new MXCHIP Azure Iot kit (Arduino)

 

The presentation can be found here:  https://github.com/apead/XUGSA/tree/master/19072017

Android Things Weather Station Sample with Azure Iot Hubs:    https://github.com/apead/Xamarin-AndroidThings-Contrib

Cross Platform Generic Xamarin Forms sample that ran on Phone, Android Things and Windows 10 Iot (I didn’t demo this, but it works too):   https://github.com/apead/XUGSABuildAutomation

 

Xamarin Android Things Nuget:  https://www.nuget.org/packages/Xamarin.Android.Things/0.4.0-devpreview

 

Xamarin Android Things Contrib Drivers:  https://www.nuget.org/packages/Xamarin.AndroidThings.Contrib.RainbowHat/0.40.0-beta

 

Getting Started with Xamarin Iot:   http://explorationspace.co.za/2017/06/21/xamarin-iot-comes-to-visual-studio-2017-on-windows/

 

MXChip Azure Kit:   https://microsoft.github.io/azure-iot-developer-kit/

 

Android Things Starter Kit with Rainbow Hat:   https://shop.pimoroni.com/products/rainbow-hat-for-android-things

 

Rainbow HAT

 

There’s a Xamagon!

 

Interesting VR Stuff happening in Aliens office

Cross Platform Iot at GXUGSA

Last night was the Cross Iot Session at GXUGSA in Johannesburg.    It’s always fun presenting all the Iot toys, but also what can actually be done with Xamarin and the rest of the Microsoft tooling.

 

It’s also not always clear that you can basically do anything you want with Xamarin, so always nice and exciting to showcase it outside the usual phone type scenarios.

 

 

Gert Talking Windows 10 Iot Core

 

 

The session featured

 

Visual Micro for Visual Studio

Visual Studio Code with Arduino Extension which is now Open Source.

Xamarin Forms and Xamarin.Android with Android Things 0.4 Preview

The new Xamarin Iot preview for Linux based devices

Windows 10 Iot Core

Azure Iot Hubs

 

Devices wise 

 

Raspberry Pi 2 + 3

Intel Edison

Raspberry Pi Zero W

Latte Panda and Arduino Leonardo

MXChip Azure Kit

Devices Devices Everywhere

The presentation can be found here:   https://github.com/apead/XUGSA/tree/master/11072017

 

Android Things Weather Station Sample with Azure Iot Hubs:    https://github.com/apead/Xamarin-AndroidThings-Contrib

Cross Platform Generic Xamarin Forms sample that ran on Phone, Android Things and Windows 10 Iot:   https://github.com/apead/XUGSABuildAutomation

 

Xamarin Android Things Nuget:  https://www.nuget.org/packages/Xamarin.Android.Things/0.4.0-devpreview

 

Xamarin Android Things Contrib Drivers:  https://www.nuget.org/packages/Xamarin.AndroidThings.Contrib.RainbowHat/0.40.0-beta

 

Getting Started with Xamarin Iot:   http://explorationspace.co.za/2017/06/21/xamarin-iot-comes-to-visual-studio-2017-on-windows/

 

MXChip Azure Kit:   https://microsoft.github.io/azure-iot-developer-kit/

 

Android Things Starter Kit with Rainbow Hat:   https://shop.pimoroni.com/products/rainbow-hat-for-android-things

 

Rainbow HAT

 

Behind the Scenes Fun 🙂

Arduino Development with Visual Studio via Visual Micro (Overview)

Visual Studio has become a one stop shop for any type of development.  But did you know you can do Arduino development as well?    There is a Visual Studio extension called Visual Micro (http://www.visualmicro.com) which will allow Arduino development and debugging within Visual Studio IDE, with the full development experience you have become used to.   This is a high level overview of what is provided.

 

Arduino and Visual Studio

 

What’s really great about having Arduino support within Visual Studio is, you can group together all the various different projects that makes up your solution all together within a Visual Studio Solution.

 

Multi-platform Solution

 

In a world of Iot and cross platform (or multi platform) development this is perfect.   You could have one or more Arduino projects, .NET Micro framework projects,  a Xamarin Mobile client and the back-end (be it an on-premise ASP .NET WEB API solution, or in the cloud with something like Azure Mobile Services) all managed together in a single Visual Studio solution.

 

Installing Visual Micro

 

Visual Micro can be downloaded here:   http://www.visualmicro.com/page/Arduino-Visual-Studio-Downloads.aspx   It is a Visual Studio extension which will be installed within Visual Studio.   There is a version for both Visual Studio 2015 and 2017 RC.     Be sure to have the standard Arduino IDE installed as well, as it uses this tooling under the hood.   Arduino version 1.06 – 1.8 is supported.

 

The IDE Experience

 

Visual Micro Toolbar

 

 

Visual Micro Menu

 

Both a toolbar and a new menu is added to Visual Studio.    The toolbar allows access to quickly configure the connected board and COM port used (via USB).    It also allows quick access for building and debugging, however if the Arduino project is the startup project the debugging and build options work as usual direct from the Visual Studio hotkeys, toolbars and menu items.    The menu allows for deeper configuration of the compiler, debugging options and other integration options.

 

File New Dialog

Templates are provided to easily create a new Arduino Sketch or Library.    Standard Arduino INO files are supported.   These standard file types are also used when opening and saving to existing Arduino Sketch files, which ofcourse can be ported back to the Arduino IDE if need be.

 

Solution Explorer

 

The solution explorer is quite neat for the Arduino.   All the source files, header files and external dependencies are presented in much the way you have grown accustomed to in Visual Studio.

 

 

The Visual Micro Explorer provides a visualization of all libraries installed.    There is also reference material and documentation provided along with a collection of Example code.   This is great for both learning and quickly looking up something.

 

The debug experience

 

Debugging Experience

 

Debugging and conditional breakpoints are supported.   This does though require a purchase of the Pro version.   The pro version has quite a number of additional features aswell which you can read about here:  http://www.visualmicro.com/page/What-features-are-included-in-Visual-Micro-Pro.aspx

 

The live tracing works great.  There is also the standard port monitor which does live logging of the Com ports.    In the screenshot provided the codes displayed are being reported from an infrared remote control in real-time.   The ability to see everything happen, and be visible, at once in an IDE saves a whole load of time.

 

Conclusion

I’ve been using Visual Micro for a few Arduino related Iot projects and can definitely recommend using it.

 

Happy Arduino coding!  🙂

Build 2015: Windows 10 IoT Preview on a Raspberry Pi 2

Day 1 of Build 2015 has been great!   The IoT inclusions especially have been very exciting for me.

 

We now have Windows 10 IoT core released and running on:

Raspberry Pi 2
MinnowBoard Max
Galileo

 

Also very interesting and exciting news is, we have Arduino support from Microsoft.

Windows Remote Arduino
Windows Virtual Shields for Arduino

 

Let’s start by installing Windows 10 IoT Core Preview on a Raspberry PI 2. I know many of you that bought a PI just to do this, I know I did. 🙂

 

Start by downloading the “Windows_IoT_Core_RPI2_BUILD” from https://connect.microsoft.com/windowsembeddedIoT/Downloads.  I had to accept some EULAs and click around before anything appeared to be selected for download.  It could have also been a timing problem as I was a bit eager to download and perhaps it was not available that soon.

 

The requirement for the installation is a Windows 10 Build 10069 or higher PC to copy the Windows 10 IoT installation onto an SD card . I downloaded the new Windows 10 Build 10074 ISO that was released today from http://windows.microsoft.com/en-us/windows/preview-iso-update-1504.

 

Install Windows 10. I ignored the recommendations and installed on a Virtual Machine (on VMWare) and not a physical PC.  VMWare  passes through the SD card without problems to Windows 10.

 

Once everything is installed, copy the “Flash.ffu” file from the downloaded “Windows_IoT_Core_RPI2_BUILD” zip file to a folder on the Windows 10 PC.

 

From an Administrator Command line run the following command:

 

diskpart
list disk
exit

 

Note the number of the disk associated with the SDCard.

 

Run the dism command replacing the N in “\PhysicalDriveN” to the number noted above.

 

dism.exe /Apply-Image /ImageFile:flash.ffu /ApplyDrive:\\.\PhysicalDriveN /SkipPlatformCheck

After a short wait, you should see: “Operation completed successfully”. Eject the SD card.

 

success

Insert the SD card into the SD card slot in the Raspberry PI 2. Plug the HDMI cable into the PI and of course the monitor. Plug the power cable into the Raspberry PI. After a few worrying minutes Windows 10 IoT should be all booted up. It will reboot once during the initial setup process and the interesting blocks displayed in-between the Windows Logo appearing and final boot-up seems normal.

 

Next step is to make it do something useful! 🙂

 

rasp pi 2 rasp pi 1

For full detail instructions you can follow this link: http://ms-iot.github.io/content/win10/SetupRPI.htm