Using Nao’s USB Port for Hardware Interfacing

by Emotion Robotics on the 31/03/2015 11:43:14

So your Nao robot has a USB port that is, typically, used for reflashing his operating system, but it can be used for so much more. The USB port is located on the back of Nao’s head under a removable cover.



This port is a standard USB and additional devices can be connected to expand Nao’s capabilities. With the release of NaoQi V2.x the underlying operating system has support for the use of 3D sensors, such as the ASUS Xtion, and this can be connected to the USB port.

Additionally, NaoQi is built on a Linux OS which has drivers for the FTDI serial chip range installed as standard. This means that any device that has a serial interface based on the FTDI chipset, to create a serial port, can potentially be used with Nao.

When a FTDI serial device is plugged into Nao, or with NaoQi 2.1.2 when he is booted with it plugged in, a ttyUSB port is created. If you have nothing else connected to the robot the default port assignment will be /dev/ttyUSB0.

In addition to having the FTDI driver software available on your Nao, you also have PySerial preinstalled. This allows your Python code in Choregraphe to directly access the serial port that was created when you plugged in your device. In your Choregraphe box that reads the serial data simply create a serial port:

self.ser.port = "/dev/ttyUSB0"
self.ser.baudrate = 9600
self.ser.stopbits = serial.STOPBITS_ONE
self.ser.parity = serial.PARITY_NONE
self.ser.bytesize = serial.EIGHTBITS



Open the port:

self.ser.open()

And read the data:

while (self.ser.inWaiting() > 0):
       character = ''
       character = self.ser.read(1)


It really is that easy. So if you have a USB device that uses the FTDI chipset to present itself as a serial port, just plug it into Nao and away you go.

The devices we have interfaced to Nao include:

  • A Gesture Sensor via an Arduino Board
  • A Thermal Array Sensor via a USB to I2C interface
  • A serial GPS Module
  • A weather station board

We would love to hear what you connect to your Nao. You can find more detailed information in our Hardware Interfacing PDF.

Archive