/hexabot

Design files and source code of a mobile robot for the Eurobot competition

Primary LanguageKiCad LayoutGNU General Public License v3.0GPL-3.0

Hexabot Sources

Design files and source code of a mobile robot for the Eurobot competition.

The controller board is built in KiCad around a dsPIC33EP256MU806 (QFN, motor control, USB). You can control it from your development machine or an embedded Linux like the Raspberry Pi (raspbian jessie recommended).

Controller PCB

The board handles various functions: motor control, odometry, sensors and servomotors. It has two layers, 10cm*10cm and mostly 0806 SMT components.

You can buy 10 PCBs for 32$ at SeeedStudio. Then we hand-soldered ours.

Layout v1

Embedded Software

The source code for the microcontroller is in hexabot-dsPIC33.X. It is controlled with the tools in linux. Most are Python scripts that use PyUSB to communicate with the board through independant USB endpoints:

  • Bulk commands to set parameters and read back values. The basic idea is to run ./command.py <register> <value> to set a value.
  • Bulk metrics broadcasting, isochronous packets for time-sensitive data. Dump them with ./usb_controller.py.
  • Serial port for debugging. Show the debug console with miniterm.py /dev/ttyACM* 9600 -D.

A higher level scripts like joystick.py uses the command endpoint to let you control the motors with a USB joystick.

User Interface

The ui directory contains a Python webserver with these features:

  • live updates of the position according to odometry,
  • graphs to visualize metrics,
  • maybe someday a way to send commands.

Setup

Download and install the MPLABX IDE and the XC16 compiler. You need xc16 v1.25+ because of bug XC16-781 (snprintf). Sadly the peripheral libraries were last shipped with v1.24 and the new Code Configurator doesn't support dsPIC33E yet. You need to copy the libraries from one installed version to the other.

Install Python 3 and debugging tools like Wireshark. For Ubuntu 15.04 you can run:

git clone https://github.com/Caerbannog/hexabot.git
sudo apt-get install python3-pip wireshark
sudo pip3 install pyusb==1.0.0b1 autobahn==0.10.4 pyinotify==0.9.6 bottle==0.12.8 pyserial
sudo adduser $USER dialout
sudo adduser $USER wireshark
echo usbmon | sudo tee -a /etc/modules
sudo cp 99-hexabot.rules /etc/udev/rules.d/
sudo service udev reload # then you need to replug the device

Contributing

Pull requests are welcome on the project page: https://github.com/Caerbannog/hexabot

Licenses

  • Hardware design files are published under the CERN OHL v.1.2.
  • Source code is published under the GPLv3 or later.
  • Note that Microchip's USB library and the CDC-basic demo have a more restrictive license.

TODO list

  • Documentation for the code. Links to documentation for the motor control and odometry.