Tasks: A Time-Triggered Scheduler for Arduino


This has been a long time coming. A few years ago (back in 2012!) I wrote a basic TT scheduler which was really more of a ‘proof of concept’ and not really friendly for an everyday Arduino user. It relied on a strong knowledge of C or C++ and needed Eclipse with an Arduino plugin to get it to work. I’ve promised myself since then that I’d  write a proper Arduino library to demonstrate time-triggered scheduling to Arduino IDE users as well as learning some C++ skills for myself. Continue reading

Hexapod on a Budget – Part 3: Movement Algorithm Prototyping with Pololu Maestro Control Center


Introduction

In part 2, I talked about the electronics layout for the hexapod. Now it’s time to make it move.

Continue reading

Hexapod on a Budget – Part 1: The Chassis


Introduction

Back in January, I wanted to kick off a new robotics project, and began looking at multipedal robot kits. I’ve found walking robots fascinating for a while now, and have been closely following the work of companies like Boston Dynamics in their search to mimic natural movement through machines. Continue reading

Accurate timing for smaller embedded projects


Introduction

Previously, I have talked about high-precision, multi-task execution on an arduino / AVR based microcontroller.

But what if you don’t need a scheduler? What if you’re only doing one thing, and all of your functionality can easily be fit into a tick period of 5 or 10 ms, but you still want the timing precision to say “These operations will be executed every x ms, and take no longer than x microseconds”. Of course, on a reasonable-sized micro, you could use a TTC scheduler such as the one described in my previous posts, and only have one task, but what if you can’t afford the additional overhead of running the scheduler. If your project calls for a small 8-bit, 8 MHz micro such as the Microchip PIC12F family, you’re limited in both the code space, and processing power. You need to completely strip down the time-triggered philosophy to its bare bones Continue reading

Cloud Robotics Hackathon 2013: Video, Results and Thanks


So the results of the hackathon were released yesterday, and I must say, we’re very happy with how things turned out. We were placed 4th against some very tough competition, and were given an honourable mention by the organisers:

Before naming the three winners, we would like to give a give a honourable mention toteam Telemetron. They created an outstanding robotic behaviour and actively participated and documented their project throughout the week. They were also very active on Twitter. As a result they submitted by far the best documentation. – Cloud Robotics Hackathon 2013 Continue reading

Cloud Robotics Hackathon 2013: Done!


So today is the day of the deadline and everything has actually come together quite nicely.

@tobypinder and I have been working on this separately since friday, using only the Internet to communicate (in the spirit of the Hackathon and all that). He did a great job with the web front end allowing us to carry out a test run with the robot transmitting live data this afternoon. There were a few hiccups with turn angles and things, but once they were ironed out, the results relatively good! Continue reading

Further task scheduling with Arduino / AVR


** EDIT 27/04/2016: I have now created a ‘user-friendly’ library compatible with the Arduino IDE **

** EDIT: I have now added the code for this to a git repo here. **

Introduction

My previous post on this topic showed a simple time triggered task scheduler for the Arduino / AVR microcontroller platforms. Although this worked very well, there were some areas which could be improved in the way the scheduler worked. To recap, the previous scheduler worked as follows:

How it worked:

  • The program sits in an empty loop when idle.
  • “Ticks” are generated by the timer driven interrupt.
  • Tasks have a period and an offset:
    • Period – How often the task is executed
    • Offset – The first tick in which the task is executed
  • The period and offset of the tasks are adjusted manually to spread the tasks out, ensuring that tasks don’t collide.
  • The ISR iterates through each task in the schedule and executes any task that is ready to run.
  • Doing this ensures that tasks are executed with precise timing (as precise as the ATMEGA timer allows). Continue reading

Reliable task scheduling with Arduino / AVR


** EDIT 27/04/2016: I have now created a ‘user-friendly’ library compatible with the Arduino IDE **

***Please note: This article is now for background information only. The code in this article has been revised, and can be found here. ***

 

There comes a point, when writing embedded software, where you need to time the execution of tasks more precisely than just having a list of functions in a loop. In order to make a system as predictable, and therefore reliable, as possible it is desirable to use a time-triggered scheduler. If you are unfamiliar with this concept, I recommend you have a scan of Dr Michael J Pont’s Patterns for Time Triggered Embedded Systems, and watch some of his lectures.

The idea is to use a small-scale operating system that runs on a microcontroller, using timer interrupts to execute tasks with microsecond precision. This isn’t a new idea; the aerospace industry have been using this approach for years to stop their aircrafts from making ‘premature landings’, but it’s rare to find it implementated on hobby-centric platforms such as Arduino. So I thought I’d have a go at writing my own. Continue reading