Showing posts with label robot parts. Show all posts
Showing posts with label robot parts. Show all posts

Monday, August 29, 2011

A mad scientist's robot platform idea

I went sailing with my family in the weekend (one of those "other hobbies" that have served as an excuse to postpone building my robot), and suddenly I realized that our boat is an almost complete platform for a marine robot. It has the following array of sensors and actuators:

  • GPS
  • Radar
  • Sonar
  • Electronic compass
  • Wind instrument (speed and direction)
  • Speed instrument
  • Autopilot
Best of all, all of these are interconnected by an NMEA 0183 network, so e.g. the autopilot is able to receive route orders from the GPS chart plotter, and the radar image can be superimposed on top of the chart plotter's map. The only things missing are 

a) an NMEA-enabled central control unit that would contain the robot's control logic, and
b) actuators for speed control using the inboard diesel engine or the sails, or preferably both.
Imagine how fantastic it would be to be able to just enter (or even better, speak) the destination and let the boat calculate the route and take you there. The boat would use GPS to navigate, its radar, sonar, wind instrument, and compass to sense what's happening to it and in its environment, and steer using the autopilot. I suspect marine chart data would have to be directly available to the control unit, though, because it cannot be obtained from the chart plotter using NMEA.

I know that controlling the sails would be somewhat tricky. I would definitely have to get a self-tacking headsail and install electric winches for controlling the jib sheets and the mainsheet. I'm not sure if I'd be able to loosen as well as tighten the sheets using a winch, so possibly some custom mechanics and motors would be required. Even so, I wouldn't have proper feedback available to my control algorithm, only the readings of the wind and speed instruments and compass (and GPS). It would be preferable also to know the positions of the sheets and the angle of heel. Come to think of it, also the rudder angle would be nice to know, as well well as some sensor readings that would correspond to the tell-tales on the sails. But these are all optional and I could add them later. Even the entire speed control capability could be omitted. Initially it would be cool just to be able to automatically navigate from A to B while controlling speed manually.

No! Wait! Based on how they behave on the sea, I think some of the bigger motor yachts in this part of the world already are robots. Oh, well.

(Of course, I wasn't the first to think of a robotic sailboat.)

Tuesday, August 23, 2011

Robot platform videos

I found video reviews of the Traxster II and Lynxmotion 4WD1 robot platforms I mentioned in my earlier post:





The Lynxmotion 4WD1 looks awesome, but the lack of support for shaft encoders keeps bothering me, as I don't think that my optical encoders would work with these wheels. The chassis is available without motors or wheels, so I could purchase motors that have rear shafts for connecting encoders separately, but the total price would be higher, especially as I couldn't get everything I need from a single source inside the European Union. Ordering directly from Lynxmotion is out of the question, because they don't accept international credit cards.

The Traxster II is a bit smaller than I imagined and it does not have a bottom plate. But it does have built-in encoders and is therefore significantly cheaper than the 4WD1 when considering total price with all the parts I need.

Sunday, August 21, 2011

Finding a new robot platform

Although I haven't yet completed my first version of SHORT-E built on the Scooterbot two-wheel platform, I have already started pondering about what my next robot will be like. As I wrote in my earlier post, the Scooterbot cannot really move on anything else than hard floor. We do have wooden floors in our apartment, but there are also rugs and thresholds that pose a big problem for SHORT-E.

Although I won't probably be getting a new platform at least for a few months, I've listed my (currently known) requirements and started to sketch a list of alternatives.

Here are my requirements:


  • Tracked, four-wheeled, six-wheeled, or similar type that can move also on carpets and rugs, and overcome small thresholds and obstacles.
  • Preferably available as an off-the-shelf kit, with chassis, wheels, motors, etc.
  • Big enough to have room to mount a Chumby One in addition to batteries, an Arduino, web camera, sensors, etc.
  • Possibility to mount a gripper or a robot arm.
  • Preferably enough space inside the chassis for batteries, Arduino and a small breadboard or printed circuit board.
  • Shouldn't cost more than 500€, and the cheaper the better.


My current list of alternatives is pretty short:

  • Large enough, seems pretty rugged.
  • Enough room inside for batteries and electronics.
  • Good-sized surface to mount Chumby, camera, sensors, and gripper on. 
  • Includes two DC motors but no batteries or electronics.
  • Motors have integrated quadrature encoders, which is nice.
  • Price: 192.55€ 



Lynxmotion Aluminum 4WD1 Rover

  • Also large and rugged.
  • Some room inside, at least for batteries.
  • Specially designed add-ons and accessories available: gripper kit, extra decks, etc.
  • Includes four DC motors but no batteries or electronics.
  • Where to fit shaft encoders? The motors included do not seem to have rear shafts. Would perhaps have to buy different motors, which would add to the cost.
  • Price: 235.43€


  • Small, but might be just large enough with the optional expansion plate.
  • Comes complete with an Arduino Duemilanove. Although I already have one, it wouldn't hurt to have two (no need to butcher SHORT-E for parts).
  • Comes with the Tamiya Twin Motor Gearbox and a DC motor controller for the Arduino. No rotary encoders, but I could probably install my CNY70 based ones. I found a good article on how to modify this gearbox for adding encoders.
  • According to the user guide, Lynxmotion Little Grip should fit. Weight would have to be added to the rear, but this wouldn't be a problem - I have to put the Chumby somewhere. I'm more worried whether the robot would be powerful enough to carry everything.
  • Perhaps too small for everything I want to install?
  • Cheap, price is 89.99€

At the moment the Traxster II is the top contestant, although I do like the specially designed accessories available for the Lynxmotion 4WD1, and the low price of the DFRobotShop Rover plus the fact that it comes with an Arduino and a motor controller.

I would really appreciate comments or advice from other robot builders. I just started this blog a couple of days ago and I know the number of readers is still small (haven't even been properly indexed by Google yet), but maybe there's already someone out there.

Friday, August 19, 2011

Rotary encoder based on CNY70 photoreflector



As I mentioned earlier, I needed to add rotary encoders on the wheels in order to measure their angular velocities. This was required to enable using a closed loop control algorithm that could keep the robot driving straight with constant velocity.

Rotary encoders are available as off-the-shelf components, complete with encoder disks and sensor modules, but they are somewhat costly considering their simplicity. Many of them are also not suitable for my purposes because there is not much room to mount stuff between the wheel and the servo assembly in SHORT-E.


I did some research and decided that I would need photoreflectors. Hamamatsu P306201 was used in Mobile Robots - Inspiration to Implementation, but neither it or its newer replacement, P5587, were available anymore, at least not on this side of the Atlantic Ocean. I then came across Vishay Semiconductors CNY70 that seemed promising. I ordered some online from Elfa. They cost 0.79€ each in a batch of ten.




A photoreflector combines an IR-emitting diode with a phototransistor and is able to sense whether the IR light it emits is reflected back or not. If one is mounted near a spinning wheel that has a striped black-white pattern, an appropriate circuit will produce a logic-level pulse stream whose frequency is directly proportional to the angular velocity of the wheel.

I printed two copies of a 24 stripe pattern I found on the web, cut them to size and glued them to the inside surfaces of SHORT-E's wheels. I then took two CNY70s, soldered wires to each of their pins, and completed two copies of the following circuit on SHORT-E's breadboard:


Note: The orientation of the CNY70 component in the diagram is such that the markings ("V69 CNY70" etc.) are on the right.

This circuit produces output voltages that are close enough to +0V and +5V to pass for logic-level signals. 200Ohms and 10kOhms were the only resistor values I had in my component box, and they probably aren't the absolute best choices, but they seem to work well enough. You could try replacing the 10k with something a bit larger to get closer to +5V when there is white stripe in front of the CNY70 (I now get around +4V).

The CNY70s need to be mounted as close to the striped wheel surfaces as possible, I mean preferably less than half a millimeter according to the datasheet, although it doesn't seem to be too picky about the distance in real life.

The outputs of each circuit (see image above) I connected to pins 2 and 3 on my Arduino. I specifically selected these pins because they can trigger external interrupts. I then simply wrote interrupt handlers that increment pulse counters on each change of the signal, i.e. in setup() I added

pinMode(encoderLeftPin, INPUT);
attachInterrupt(0, doEncoderLeft, CHANGE);
pinMode(encoderRightPin, INPUT);
attachInterrupt(1, doEncoderRight, CHANGE);

Here encoderLeftPin and encoderRightPin are just names that correspond to 2 and 3, i.e. the Arduino I/O pin numbers for external interrupts 0 and 1. Functions doEncoderLeft() and doEncoderRight() simply just increment integer counters.

The code I described above just counts the pulses but does not affect control yet. In addition I implemented a PID controller and spent a few hours tweaking its parameters to get SHORT-E behaving nicely. PID controllers are textbook material and also the Wikipedia article I just linked to contains a nice pseudocode description as well as discussion on what the different parameters do. Therefore I think I won't go into the details here.

Initial electronic and electrical parts list

Very quickly I came up with a list of the electronic and electrical parts I would require for the first version of my robot, SHORT-E. I bought the parts from a couple of sources: an Ebay seller in Hong Kong and Robot Shop. This is what I got:

An Arduino starter kit from Ebay (31€ inc. p&p):
  • Arduino Duemilanove w/ ATMega 328
  • breadboard
  • 1602 LCD module
  • USB cable, some jumper wires, potentiometers, LEDs, buttons, resistors, etc.
Other stuff from Robot Shop EU:
  • Devantech SRF05 ultrasonic range finder (sonar)
  • Dagu mini pan&tilt kit w/ two mini servos (for pointing the sonar in different directions)
  • Lynxmotion multi-purpose sensor housing MPSH-01
  • a battery holder for 4 AA batteries (4*1.5V=6V, for powering the servos)
  • a 9V battery jack with an Arduino-compatible plug (for powering the Arduino, obviously)
  • some break-away headers for soldering into the sonar module
I already had:
  • two GWS S03N servos modified for continuous rotation (to be used as drive motors)
I suspect my "Arduino" Duemilanove is not a genuine Arduino. The price was suspiciously cheap and there seem to be some cosmetic differences compared to images of genuine ones. While the design is open source and anyone is allowed to make and sell Arduino-compatible boards, they shouldn't be using the name Arduino. Oh well, the Chinese aren't too strict about these things.

I was planning to add other parts later. With only the parts listed above I would have to resort to open loop motor control, which would probably cause SHORT-E not to be able to drive completely straight, and to slow down if going uphill, etc. So already when I ordered my first batch of parts I knew that I would at least have to get some components for making rotary encoders later.

Choosing a robot brain

Choosing a robot brain took some research and thought. In the beginning I was determined that my robot would run Linux. I wanted to be able to connect a web camera and communicate with the robot using WiFi, and thus a Linux board seemed to be the obvious way to go.

First I considered using a Mini-ITX form-factor Atom-based motherboard. There were few problems, though. First of all, they are relatively expensive, and still a bit too big to be installed on the Scooterbot base. Second, they wouldn't be able to control most robot sensors and actuators without adding a separate controller card. Third, and this is the biggest problem: they consume a lot of power, and would require batteries that are either big and heavy or very expensive.

Then I turned to look at embedded Linux development boards. Many of them looked ok, but they were very expensive. It seems that nobody wants to sell this stuff to hobbyists, and thus the developer packages cost and arm and a leg. Community support also seems scarce, probably because these devices are mostly used commercially.

Next I looked at Chumby One. Now this looked promising. A hacker-friendly, open-source, complete Linux computer with a 454MHz ARM processor, 3.5" touch screen, audio, WiFi, and USB, optional Li-Ion battery, and available for 79€ in my country. The only problem was that it wouldn't easily connect to sensors and actuators, at least without some major hacking of the mainboard. There is also a Chumby Hacker Board that's better equipped for low-level interfacing with stuff, but it costs the same as a complete Chumby One and doesn't have the screen, or the battery compartment.

So, even if I were to eventually use a Chumby, I would need something for interfacing with my sensors and motors. And remembering the first law of recreational robotics, that something could perhaps also initially serve as the first brain of SHORT-E. I would be starting simple. I just needed something I could later connect to a Chumby, i.e. something with USB.

I turned to look at Arduinos. They are Atmel ATMega microcontroller development boards based on open source hardware designs, especially intended for "artists, designers and hobbyists". There is an active community that develops both hardware ("shields" that can be mounted on top of the Arduino board, e.g. DC motor controllers) and software. Extensive libraries and a tailored programming language (simplified C with Arduino-specific extensions) with a custom Integrated Development Environment (IDE) make programming efficient and easy. And best of all, Arduinos can be programmed and interfaced with through USB.

So, I decided that SHORT-E's first little brain would be an Arduino. Later it would perhaps step back and assume the role of a sensor and motor controller as a Chumby or some other Linux box would take over as the main computer.

The birth of SHORT-E: platform

I decided to name my robot SHORT-E (an obvious reference to WALL-E). Applying the first law of recreational robotics, I wanted to start simple and just build something that moves, avoiding bumping into things or getting stuck, at least mostly.

I purchased my robot platform already years ago from Budget Robotics. It's called Scooterbot and looks (almost) like the image here. Mine's blue and the wheels look a bit different.

The Scooterbot platform came with two GWS S03N R/C servo motors pre-modified for continuous rotation. Normally these servos are used for position control and cannot rotate past a limiter, but the modification makes them suitable for use as robot drive motors.

So, SHORT-E will be a two-wheel differential drive robot, i.e. it will be steered by making the left and right wheels spin at different speeds or even in opposite directions. The Scooterbot base is extremely simple: it doesn't even have a third (freely rotating) wheel, but just a plastic knob that slides across the floor, hopefully with minimal friction.

If I were purchasing a robot platform today, I probably wouldn't choose this type. The problem with Scooterbot (and other similar two-wheel designs) is that it is extremely bad at moving on anything else than hard floor. It can just manage on a (non-furry) carpet, but cannot drive over even the smallest of thresholds or climb from plain floor onto a carpet, even a thin one. I would seriously consider a tracked or a four-wheeled base. But, as I happened to have the Scooterbot base lying around, it is what I will use, at least for the first version of SHORT-E.

Servos as robot drive motors, on the other hand, are perfectly in accordance with the first law of recreational robotics, because they are simple to use and control. They generate plenty of torque and can rotate almost arbitrarily slow (unlike DC motors) as well as go fast, and can be directly controlled by the pulse width modulation (PWM) peripherals that are built-in in many microcontrollers.