A SimpleBiped with an RTOS on an Arduino Mini

In Development, Technology

Arduino SimpleBiped with RTOS

About two years back I wrote up a program for and designed a bipedal robot (I coined it the SimpleBiped) based on the Arduino Micro board. This article is an outline of what I did, mainly for reference if I revisit this later, but hopefully its useful to you as well. I designed a bipedal robot which uses ultrasonic sensors for object detection, and some basic logic for navigation as well as some primitives for servo control. The robot had 5 servos as defined in the code below. Here is a hardware spreadsheet on what I used for the build. The body parts were found on Thingiverse, modified in blender and printed with this:

My Old Thing-o-Matic
My Old Thing-o-Matic

That printer was awesome at the time and definitely served it’s purpose. It unfortunately no longer works (going to make some iteration of the Prusa eventually). I don’t have pictures of the robot and my last iteration is in storage in NY right now (I am in Georgia). I will post the blender parts up some time on my Thingiverse (all that is there now is the enclosure for the Arduino micro I integrated into the body) and link them here. Once (and if) I get started on this I’ll post circuit diagrams as well. At first the robot would walk, stop, scan for objects – then make a choice and continue walking. That code looks something like this:

This was all well and good, but I decided it would be nicer if the robot could scan for obstacles and walk at the same time. To this end, considering that Arduino natively runs programs as a loop, it was time to get into interrupts and get multiple threads running on that little ATmega32u4 with 28KB of usable Flash for programs, 2.5KB of SRAM, 1KB of EEPROM and a 16Mhz clock speed. So the question was, how? After some research I stumbled upon ChibiOS and the port for ChibiOS Arduino. ChibiOS is a great library for running multiple “threads” on Arduino. I modified the above code to this effect (see this forum thread):

Unfortunately I never got this working smoothly and the robot would jitter too much while walking due to the interrupts. Mutexs and Semaphores are tough to get right, I’d love to revisit this project at a later time (once I have a working 3D printer for body components again). Feel free to use this code (but not the name SimpleBiped) in your projects under a GNU/GPL liscence, or (and I would appreciate it), tell me where I went wrong with my mutexs!

If and when I do revisit this project I will definitely post further updates here.

Submit a comment