Communication with an Arduino on serial port

This example shows how MyViz, running on your computer, can communicate with an Arduino Uno  through a serial link.

The files can be downloaded for the following systems:

In order to run this example, you need to follow these steps (provided that MyViz is already installed):

  • Download the files somewhere on your computer
  • Connect your Arduino board to your computer
  • Upload on this board the sketch “Tutorial_SerialPort_2.ino”, located in the “Arduino” folder of the archive. As you will see in this sketch, data to be sent and data that are received are just comma-separated
  • Run MyViz. It opens with an empty window:

myviz_1

  • Click on “Load Dashboard” and open the file “Tutorial_SerialPort_2.json”, located in the “Dashboard” folder of the archive. You will probably get an error like this:

myviz_1

Don’t panic: this error just means that you need to change the name of the serial port in this dashboard:

  • click on the icon on the top-middle of the window in order to activate the “Edit” mode and click on the name of the datasource (“sp”):

myviz_2

  • You can then replace the name of the serial port by the one used by your Arduino board. Don’t hesitate to take a look at how sent and received data are defined: you give them an arbitrary name in this interface and this name is used in the widgets to display or control these variables
  • If it works, you can:
    • click on the LED switch to switch on or off the LED of your Arduino
    • move the slider, to see the plot of the value sent back by the board
    • connect the analog inputs A0 and A1 to any sensor to see their values plotted in real time
    • modifiy the multiplication factor for these inputs
  • If you still don’t see values “moving”, double check the name of the serial port connected to your Arduino
  • To edit the dashboard, click on the icon on the top-middle of the window. Then you can modify any widget and learn how MyViz works: