SunRover part 1: Track motor controller/power system

Lead Image © iimages,

Build a Bot

Take your first steps in building a solar-powered robot.

I've always wanted to build a robot. Wait a second, I built one in the 1980s from a kit. A Heathkit HERO I robot to be exact. The HERO I cost me a fortune and I could not do very much with it, but I did chase the cat. I think the cat thought it was a vacuum cleaner and ran in terror whenever it started up.

The HERO 1 [1] cost $1,500 and had a Motorola 6808 (read 8-bit processor), 4KB of RAM and a 2KB ROM monitor. The storage was a cassette tape, and the display was made of fabulous seven-segment LEDs. It even had a speech synthesizer that sounded worse than a TI Speak & Spell [2]. Your $15 Arduino has more functions and storage, and a Raspberry Pi is orders of magnitude more powerful.

It was a great introduction to robotics, though, and when I became a professor I used the robot extensively in embedded systems classes because students could see the physical results of their programming. We always walled off the stairwells in the hallway, because sometimes the robot would go crazy and head straight for the stairs.

Enter 2015. I decided it was time to build a new robot based on modern electronics and technology and do it with the Raspberry Pi. After looking at several alternatives, I decided to build SunRover, a solar-powered robot designed to operate autonomously most of the time. The key differences between this design and others out there is that this robot operates on solar power and has to manage that solar power very well to keep working. As in Project Curacao [3], I settled on a two-processor design, a low-power Arduino Mega 2560 for power management and a Raspberry Pi 2 for the brains.

What Is SunRover?

SunRover is a tracked, solar-powered robot designed to move around and explore while sending back reports, tracking weather, tightly managing a power budget, and providing a platform for testing new sensors and equipment as they become available. In the next five issues of Raspberry Pi Geek magazine, I will cover each of the major subsystems (shown in Figure 1) that go into building a solar-powered robot.

Figure 1: SunRover block diagram.

A lot of thought is required to put together a good block diagram when designing a project. You make a lot of decisions that might be difficult to change later in the design. Here is a list of the major system decisions you can infer from the SunRover block diagram:

  • Use a prebuilt track and motor controller system
  • Solar-powered system
  • Solar panels will be shifted from one subsystem to another according to demand and task set
  • Two major computers: a Raspberry Pi 2 for higher levels of control and an Arduino for power management and powering devices and sensors on and off
  • Dual WiFi communication paths
  • SunRover control panels using RasPiConnect [4].

That is a lot of design decisions made at a very high level. Next, I'll give a quick explanation of each of the subsystems of SunRover and then I will dive into the motor controller and the power subsystem for this first part of the SunRover design.


Track Motor Controller/Power Subsystem. SunRover is a mobile, solar-powered, tracked robot designed to be reliable and used outdoors. This puts more constraints on building the physical parts of the robot because it needs to be pretty tough and move over rough ground. I chose to go with a reliable, robust, tracked chassis because the point of this project was building the solar power system, the sensor base, and the software – not the mechanical design of the tracks. I also wanted to use an existing motor controller that provides a lot of flexibility (Figure 2). The Dagu products listed below fit the criteria.

Figure 2: Dagu T'REX tracked robot chassis with controller installed.

The track motor subsystem consists of the following four items:

  • Dagu T'REX tracked robot chassis [5]
  • Dagu T'REX motor controller [6]
  • Three LiPo 6,600mAh batteries [7]
  • Two SwitchDoc Labs Quad Power Management boards [8]

Solar Power Mux/Power Subsystem. SunRover is a solar-powered robot, so controlling and allocating the incoming solar power is a major part of the project. The Solar Power Multiplexer dedicates one solar panel to the Arduino WatchDog system (as a failsafe in case of brownout conditions, so the WatchDog subsystem will always recover first), and the other five panels can be switched between any of the three other power systems (WatchDog Arduino, Raspberry Pi, and the Motor Subsystem).

Control Subsystem/Raspberry Pi 2. The brains of the robot (or at least the cerebral cortex) is a Raspberry Pi 2 quad-core board. Why the Raspberry Pi 2? I wanted a bunch of computer power available to do things like image processing, route planning, and controlling the non-power system sensor packages. The main RasPiConnect control panel for the robot will fit right in here. I'm also connecting a small display to show the status of the main processor.

I2C Control Subsystem. I'm using the I2C bus to connect the vast majority of the sensors and the various motor controllers inside of SunRover. There are two groups of I2C buses: one for the WatchDog Arduino and one for the Raspberry Pi. I am using the SwitchDoc Labs I2C four-channel multiplexer [9] to isolate address ranges, provide both 3.3V and 5.0V I2C buses, and even to attempt to communicate between the WatchDog Arduino and the Raspberry Pi.

Using the I2C bus to communicate between the Arduino and Raspberry Pi was not reliable and would occasionally hang. Apparently the Arduino was acting as a master and a slave, but I couldn't find the issue after several hours of work. After I changed to a serial communication path between the Pi and the Arduino, using the handy voltage level-shifting GPIO pins on SunAirPlus, communication worked well and reliably. Note that this is the same solution I used to communicate between the Pi and the Arduino on Project Curacao. In one of the next SunRover articles, I'll talk about the serial connection libraries.

A clever part of this design is that, with very careful software controlling of the two I2C muxes, you can talk to the same I2C device (e.g., the motor controller) with both the WatchDog Arduino and the Raspberry Pi.

Weather Sensor Subsystem. The weather sensor subsystem in SunRover will detect the following values:

  • Wind speed
  • Wind direction
  • Rain
  • Inside temperature
  • Inside humidity
  • Outside temperature
  • Outside humidity
  • Dust count outside
  • Luminosity
  • Light color (can be used to detect some kinds of pollution)
  • Lightning detection

I do this by using the WeatherPiArduino/WeatherRack sensors [10] combined with an Embedded Adventures AS3935 lighting detector I2C sensor [11], which was highlighted in a previous issue [12]. You can see the anemometer and the wind vane in the SunRover logo in Figure 3. It might be a little clunky, but it should work great.

Figure 3: SunRover concept diagram showing tracks, solar panels, weather instruments, and Pi Camera.

WatchDog Subsystem/Arduino Mega 2560. The WatchDog subsystem is designed to monitor the power systems (three systems – WatchDog, motors, and Raspberry Pi), make adjustments to the solar panels, and regulate the charging of the devices (with the help of SunAirPlus solar controllers and chargers [13]).

The WatchDog will also be used to schedule wake-up times for the Raspberry Pi and gather certain kinds of data while the Pi is asleep (e.g., the weather data). It will have a second WiFi device that will be shut off most of the time, just waking up periodically to send a "phone home" set of data packets.

Auxiliary Sensor Subsystem. Two parts of the other subsystem are for the SunRover sensors. The internal sensors and the camera are permanently attached to SunRover, and an extended 3D-printed box attaches to the front of the robot in which I can place temporary and experimental devices such as a spectrometer or a small servo-controlled arm. This is the element that I will be changing as new cool sensors become available.

Raspberry Pi Software. The software for the Raspberry Pi will be built primarily on Python using a scheduling system called Advanced Python Scheduler (APS) [14] and generally will be task and time oriented. In this "soft real-time system," tasks are executed in order but aren't guaranteed to run at an exact time. It's designed to be kind of mushy, which is the right type of real-time system to build on a Raspberry Pi, because Linux is a pre-emptive multitasking operating system, and you can't depend on exact times of execution. Hence the term "soft real-time system."

You can get a lot more accuracy out of an Arduino, but you just don't have the resources and software that you do on a Raspberry Pi. A "hard real-time system" tries to guarantee order and time. You can't do that very easily in a complex operating system like the Raspberry Pi has. Try to set up a program on a Raspberry Pi that will turn a GPIO line on and off every 1 millisecond. If you look at it on a logic analyzer [15], you will see jitter. It won't execute exactly on the 1ms mark every time. That's why most servo controllers use an external PWM device to get good, accurate movement.

Now, on to the first module in SunRover: the motor controller and power subsystem.

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content