Workshop 6 - Serial Communication

Serial is a very simple communication protocol whereby one bit of information is sent/received at a time, i.e. a 0 or a 1, there is a buffer either side to keep hold of a certain amount of bits and we can read them in or out of our code as we need to. We also need to make sure the buffer doesn't overflow and we need to know where the message starts and stops to make sense of it. 

In order to send a whole character to/from our computer we will need to send a 'byte' or a string of eight 0s and 1s (e.g. 'a' = '1100 0001'). We can use programming techniques and Arduino functions to get at this serial data as characters and use them to create control systems between computer and Arduino. This is grossly simplified and you will not have to get too involved in the science at this point, suffice to say there are many online resources to help you design a serial protocol system that is suitable for your project, for example, heres one on the Arduino forum.

We are going to start off looking at the 'AnalogInOutSerial' example under 'Examples/03.Analog' from the Arduino IDE 'File' menu, it will link you to the tutorial on the Arduino website here.

  • Make the circuit - you should be able to make the circuit shown on a breadboard by now
  • Read the description of the code - take particular note of the 'map' function, we have used this before in our PWM example. 
  • Upload
  • Check the serial monitor - turn the pot and observe the read out. 

So, we have communication with our computer and can read serial from the Arduino console, but how are we going to do something a bit more interesting with that? Well, at this point we are going to have a little look at some extra software, Max MSP. 


Workshop 1- Hello World!

Simple use of a button (a digital input) to turn an LED on

Workshop 2 - Analog inputs/outputs

Reading a fader/knob/sensor (analog input) to fade an LED

Workshop 3 - PWM and servo motors

Control a servo motor using Pulse Width Modulation

Workshop 4 - Fritzing! 

Having a look at circuit design using Fritzing

Workshop 5 - Soldering

Some tips on soldering

Workshop 6 - Serial Communication

Exploring how to communicate with the computer via serial

Workshop 7 - Controlling Max MSP

A look at Max MSP and how we can speak to it from Arduino

Workshop 8 - Making a video system

A look at some of the built in video modules of Max and using Arduino to control them

Workshop 9 - Max to Arduino

Going the other way and using a Max user interface to control Arduino hardware