Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 3.26 KB

README.md

File metadata and controls

65 lines (48 loc) · 3.26 KB

Arduino - docker swarm demo

It is a simple demo of how to use an arduino UNO to control docker containers on docker swarm cluster with docker remote API. For the demo we used Grove - Starter Kit Plus which contains components listed below.

Grove - Starter Kit Plus components

Used tools/libraries

Get started

Because the demo use Johnny-Five library you need to first install Arduino IDE. It will let you to upload "StandardFirmata" sketch which allows you to communicate through the usb cable between your computer and Arduino microcontroller.

  1. Download Arduino IDE from the site and install it.
  2. Run Arduion IDE and from menu "Tools->Board" list select Aruduino/Genuino UNO. menu_board
  3. Connect usb cable to your computer and microcontroller.
  4. Select from menu "Tools->Ports" a port which you use for communication with arduino. menu_ports
  5. From menu select "StandardFirmata" sketch. File->Examples->Firmata->StandardFirmata menu_standardfirmata
  6. When is opened, upload the sketch. menu_upload Now you can close Arduino IDE and use Johnny-Five library.

Arduino docker swarm demo

To run the demo you need to first connect all components to Base Shield. Below is description how to connect them.

  • RGB Backlight LCD - whichever I2C socket.
  • Touch Sensor - D3
  • Button - D4
  • LED - D6
  • Rotary Angle Sensor - A0
  • Servo - D5

Next clone the project and install node. Inside project folder run npm install

Now you need to create docker swarm cluster, for this demo use the guide

When you finish, run the demo using the command npm start

The configuration has the following actions:

  • LCD displays active docker image information (Container name, image name, container id, memory usage, cpu usage).
  • Button click - switch active container information of LCD screen.
  • Touch sensor - runs new image in this case ubuntu one.
  • LED - Used to alert when container CPU usage is more than 80%.
  • Rotary Angle Sensor - controls servo.
  • Servo - it is controlled with rotary sensor. It is only for testing we should use it for something more clever.