IoT: In the Cloud - Arduino IoT Cloud controlled MKR Robot ARM
The Internet of Things is still a hot marketing topic covering everything from Voice Assistants, and Smart Lights, to connected Refrigerators that can order groceries straight from a panel on the door of the frig. There are many predictions that by 2025 there will be something like 21 billion IoT devices chirping on the net. Considering this, and the increase of the MKR line of dev boards from Arduino, it seems quite appropriate for the folks at Arduino to delve into the Cloud with their Arduino IoT Cloud offering which is Powered by Amazon Web Services (AWS). Although the IoT Cloud is still in Beta, it does offer some very cool features that take advantage of the MKR devices as well as other connected Arduino devices and Linux based systems such as Raspberry Pi, BeagleBone, and the latest Intel UP boards.
In this project, a Robot Arm controlled by a MKR1000 and a MKR1010 powered conveyor belt will be used to test the Arduino IoT Cloud features and how it can be used to control these devices in a simulated Manufacturing environment. Also, a MKR Relay Proto Shield, MKR MEM Shield and a MKR2UNO Adapter board along with a Make Wicked Devices Motor Controller board will be used. A Robot ARM make of foam board with 5 servos connected to the Make Motor controller and MKR1000 will be used to simulate a Robot Arm in a manufacturing environment. A conveyor belt will be created to connect to a MKR1010 and MKR Relay Proto Board will be used to move widgets for the Robot Arm.
MKR2UNO Adapter Board - https://www.newark.com/arduino/tsx00005/eval-expansion-board-uno-shield/dp/47AC6343
Make Motor and RC Shield for Arduino v1.1
American Robotic Supply MG-90M Micro Servos
Tower Pro SG92R Micro Servos
Parallax 2-Axis Joysticks
Arduino IoT Cloud - https://www.arduino.cc/en/IoT/HomePage
Arduino Create - https://www.arduino.cc/en/Main/Create
Eclipse MQTT - https://mqtt.org/tag/eclipse
Robot Arm based on the FoamArmDS design at EasyDS
MKR1000, MKR2UNO and Make Motor Controller stack and Joystick control
MKR1000 Firmware Update
There could be issues seen connecting the MKR1000 to a WiFi router and thus the IoT Cloud, so before connecting a MKR1000 to the Arduino IoT Cloud, it is best to check the firmware version installed on the board and update it as necessary.
For MKR WiFi 1010 Firmware Update, see the following post
The instructions for the MKR1000 are from the following:
1. Downloaded the latest version of the WiFi101 Libraries from:
2. Add the zip file via Add .Zip File... under Sketch -> Include Library
NOTE: This updates the Wifi101 to 0.15.3
3. Under Examples->WiFi101, select, build and load the CheckWiFi101FirmwareVersion Sketch.
If the result of the Firmware check is NOT PASSED, then proceed with updating the firmware:
WiFi101 firmware check. WiFi101 shield: DETECTED Firmware version installed: 19.4.4 Latest firmware version available : 19.5.4 Check result: NOT PASSED - The firmware version on the shield do not match the version required by the library, you may experience issues or failures.
4. Under Examples->WiFi101, select, build and install the FirmwareUpdater sketch
5. From the Arduino IDE Menu, under Tools, select Wifi1010 / WifiNINA Firmware Updater.
6. Select the MKR1000 serial port connection and then Update Firmware version.
Version 19.5.4 was selected to match the version shown in the FirmwareChecker but there was a newer version 19.6.1 shown.
7. Click the Update Firmware button to update the firmware.
When complete and successful, a pop up windows should appear indicating the firmware update completion.
8. If successful, go back to the Firmware Checker (Step 3) and see if the firmware was updated.
The result should now show PASSED
WiFi101 firmware check. WiFi101 shield: DETECTED Firmware version installed: 19.5.4 Latest firmware version available : 19.5.4 Check result: PASSED
9. From the Arduino Create IoT Cloud IDE, the device should indicated connection if working properly.
Monitor output with debug set to 2
[ 10081 ] Connecting to Arduino IoT Cloud... Compile time: 1553040000 [ 12186 ] Connected to Arduino IoT Cloud
Arduino Create IoT Cloud
If no device has been added to the Device Manager, click on Add New Board to add one.
Or go to the Getting Started Page:
After adding a device it will appear in Device Manager
NOTE: The device will appear if it is connected or not.
Click on the Checker board Icon in the upper left corner to navigate to get to Arduino IoT Cloud or other options.
Click on Arduino IoT Cloud to add Things.
Here a MKRLED Thing was created which is use to turn on and off the LED_BUILTIN
NOTE: Currently only a single Thing can be created, I guess since I get the following when trying to add a new Thing
"No more Things left on your current plan, please remove your existing Thing before creating a new one. Arduino Plans coming soon!"
Clicking on the defined Thing displays a window showing the Thing's Properties as well as options to add code and edit the thing. A Thing can have multiple Properties.
Selecting Edit Code will bring up the Arduino Create Editor
Here, a onLEDVAL_Change method was created when the MKRLED Thing was created. The method is declared in thingProperties.h.
Click on "GO TO IOT CLOUD" to go back to the Thing. Clicking on the eyeball Tab of the Thing brings up window to interact with the think.
A Switch that can be turned on and off is used to toggle the MKR1000 LED (6).
MKR1000 LED_BUILTIN Off
MKR1000 LED_BUILTIN On
Video showing the the MKR1000 LED control from Arduino IoT Cloud