Page 2
Cheers! Acknowledgements This guide will give you a quick orientation of the Ringo robot and how to program him, but first we want to give a few acknowledgements. Ringo is Open Source Hardware, which means his design is open to study and learn from. He wouldn’t have been possible without others before us sharing their own open source creations with the world.
Page 3
All this to say, you don’t have to worry about discharging Ringo too far. He will take care of himself if he is left on or run too long without a charge. If you notice Ringo is tending to reset on his own, it is likely because the battery voltage is getting low.
Page 4
We’ll cover the use of this button later in this guide. This port connects Ringo to the Plum Geek Programming Programming Port: Adaptor. It is used to load Ringo with his programming. It can also charge Ringo’s battery when the Programming Adaptor is plugged into a USB power source. SKILL LEVEL Ringo Educational Guide Rev04.1 ~ Plum Geek...
Page 5
(like the light sensors), you’ll see these readings spiking a lot more while charging is allowed. In this case, it may be useful to prevent Ringo from charging while still allowing Ringo to communicate with your computer. Remove the jumper to suspend charging.
Software Installation Install the Arduino IDE (Integrated Development Environment) Access the Internet In order to program your Ringo, you’ll need to download the newest version of the Arduino software rst from www.arduino.cc. (it’s free!). is software, known as the Arduino IDE, will allow you to program your Ringo to do exactly what you want.
Page 7
Visit www.plumgeek.com and follow the instructions to install the required driver for the programming adaptor. It is super important that you do this before connecting the programmer to your computer. SKILL LEVEL Ringo Educational Guide Rev04.1 ~ Plum Geek...
Connect a USB cable between your computer and the Plum Geek Programming Adaptor. connect the Programming Adaptor to your Ringo robot using the supplied cable. You will require a USB A to Mini B cable (commonly supplied with digital cameras and the like).
Page 9
Try not to pull the ribbon cable off of Ringo by the cable - try to use the black plastic ends if possible. This again will help reduce stresses on the cable.
Page 10
Verify: Compiles and approves your code. It will catch errors in syntax (like missing semi-colons or parenthesis). Upload: Sends your code to the attached Ringo robot. When you click it, you should see the red lights on the Plum Geek Programming Adaptor blink rapid. IT IS VERY IMPORTANT TO MAKE SURE YOUR RINGO IS SWITCH ON PRIOR TO UPLOADING.
Page 11
Archive Sketch Fix Encoding & Reload Serial Monitor Board Serial Port /dev/tty.usbmodem262471 /dev/cu.usbmodem262471 Select the serial device of the Ringo robot from Programmer /dev/tty.Bluetooth-Modem Burn Bootloader /dev/cu.Bluetooth-Modem the Tools | Serial Port menu. On the Mac, this /dev/tty.FireFly-7256-SPP should be something with /dev/tty.usbmodem /dev/cu.FireFly-7256-SPP...
Page 12
Visit the plumgeek.com website. Download libraries & examples, and install them in your Arduino folder. In order to easily program and use your Ringo robot, you will require several library folders, as well as a folder full of examples. You will need to place the three library folders (RingoMsTimer2, RingoWire, and Adafruit_NeoPixel) into your Arduino/ libraries folder.
Page 13
Copy the three folder “Ringo_Examples” choose “unzip”. into Arduino’s folder named “examples”. Show Package Contents Move to Trash This section has been largely reproduced from the SIK Guide for the SparkFun Inventor’s Kit. SKILL LEVEL Ringo Educational Guide Rev04.1 ~ Plum Geek...
Page 14
Those more experienced with coding are encouraged to have a look at these extra tabs. Feel free to modify or improve them as the Ringo software is a work in progress and we welcome the user community to add features and make improvements.
Page 15
Code Basics Let’s cover a few basics... I know you’re itching to make Ringo do cool stuff, so play with some of the pre-loaded behaviors for a while. Eventually, you’ll want to customize how Ringo behaves. For this, you’ll need to learn a few basics about the code.
Page 16
Comments are ignored by the Arduino IDE when it compiles the code before sending it to Ringo’s brain. Comments can be written two ways. A pair of forward slashes denotes everything else following them on the same line as a comment, and thus is ignored by the compiler.
Page 17
(or setup() loop() until you turn off or reset Ringo, or until his battery runs too low and he shuts off automatically). The function is where the bulk of you program usually lives.
Page 18
If you look around on YouTube you’ll find lots of great explanations as well as awesome projects people around the world have created with Arduino. Here are a few video courses we think you’ll enjoy. Remember that Ringo is basically an Arduino board without connecting headers - we’ve just connected the electronics directly to the microcontroller, so many of the examples you’ll find online are still...
Page 19
The NeoPixel lights are extremely bright, so a value from 100 to 150 is still plenty bright. As stated, Ringo has six of these color lights. Computers like to number things beginning with 0. So the lights are actually numbered 0 through 5 (not 1 through 6 as you may expect).
Page 20
RingoHardware.h line: By including RingoHardware.h, the IDE will #include <Adafruit_NeoPixel.h> automatically include the file which allows Ringo to talk to his Adafruit_NeoPixel.h lights. void setup(){ HardwareBegin(); //Sets all of Ringo’s I/O pins correctly SwitchButtonToPixels();...
Page 21
//this code is the same SetPixelRGB( BODY_TOP, 0, 0, 200); //as this code Lets see if we can make the light on the top of Ringo’s body turn blue. You’ll be writing most of your code inside the function (at least until you start void loop(){ writing your own functions!).
Page 22
Sweet! Purple, right? I think you’re getting the idea now. So what if you want to control more than one pixel at a time? What if we want to make both of Ringo’s eyes turn purple? We just do the same thing, except we call the SetPixelRGB function more than once.
Page 23
Ringo’s battery can only safely supply about 200 milliamps. For this reason, all the parts on Ringo that are capable of drawing a lot of current (the NeoPixels, motors, sound chirp, underside edge sensors, and the three infrared emitters) are all powered through a limit switch that limits current to the safe 200 milliamps.
Page 24
(called a “compiler”) reads your code and turns it into a bunch of 1’s and 0’s that make sense to Ringo’s brain. The it is very easy to make the compiler grumpy, in which case it will throw a fit and refuse to do what it’s told.
Page 25
Well, “delay” does just delay(100); what you’d expect it to. It causes Ringo’s brain go spin in a circle and do nothing for a certain amount of time. The argument passed is the number of milliseconds Ringo’s brain should wait before proceeding.
Page 26
3) Good job! You made the bottom lights work! What happens if you now take Ringo into a dark room and place him on different surfaces while the bottom lights are lit up? (Hint, look for something semi-opaque, a clear table top, and a white surface and see what happens).
Page 27
This isn’t dangerous to Ringo, but it will make the lights go all wonkey on you until Ringo is reset and loaded with new code that doesn’t draw so much current.
Page 28
OnEyes(Red, Green, Blue); //makes eyes the given color LeftEye(Red, Green, Blue); //sets left eye to given color RightEye(Red, Green, Blue); //sets left eye to given color OffEyes(); //turns off eye lights SKILL LEVEL Ringo Educational Guide Rev04.1 ~ Plum Geek...
Page 29
Let’s see how this works with an example on the next page, but first, let’s consider a few important notes. Ringo is not an all-terrain robot, so he does require a smooth surface to move properly. Desktops, counter tops, and smooth flooring are ideal surfaces.
Page 30
Using Ringo’s Motors Forward Movement If we can make both motors turn in the forward direction, then Ringo should move forward. Let’s try this example and see what happens: void loop(){ Motors(200, 200); // set left and right motors to 200 speed delay(1000);...
Page 31
Using Ringo’s Motors Backward Movement Now lets make Ringo move backward. Backward movement works the same way as forward movement, you just give Ringo negative movement numbers. Try this example: void loop(){ Motors(-200, -200); // set left and right motors to NEGATIVE 200 speed delay(1000);...
Page 32
Lets go back to where we started in this discussion and look at forward movement a bit more closely. Let’s try the example code below. Ringo is going to drive much further this time, so you may want to test this example on a floor. If you’re doing this on a table, be ready to catch him before he jumps off the edge.
Page 33
Well lucky for Ringo (and you!), he has two sensors that can be used for this purpose. One is called a Gyroscope, which basically allows Ringo to know when he is turning.
Page 34
If you find the motor clip is dragging, it can be corrected by making two adjustments. a) Make sure Ringo’s motors are flush with the end of the motor clip. If the motors have been pushed further inward into the clip, the shaft is effectively shortened.
Page 35
2) Bent Motor Shaft: This should not be a common problem, but it is possible. If Ringo takes a fall onto a hard surface and happens to land right on one of his motor shafts, it is possible the shaft could become bent. In all our testing, our Ringos have taken many hard falls onto a concrete shop floor from 3 to 4 feet heights.
Page 36
Ringo can make simple sounds with a piece of hardware called a piezo. The piezo is similar to speaker, and can be used to create tones. Causing Ringo to emit a tone from his piezo is super easy. Just use the function. The PlayChirp function takes two PlayChirp() arguments.
Page 37
//wait 2 seconds Run the code on Ringo and see (hear?) what happens. You should hear a mid pitch tone for one second that then transitions to a higher pitch tone for one second, then you should hear silence for two seconds, then the process should repeat.
Page 38
Chirps, Zips, and Pings! Sound! Playing Note Pitches: If you want Ringo to play a song, you can tell him to play specific notes. Look at the tabs across the top of the Arduino IDE (or click the little down arrow at the end of the tabs if you can’t see them all) and select the tab called “Pitches.h”.
Page 39
Ringo’s body - there are the three ambient light sensors on the top side, and there are also three light sensors on the bottom side of Ringo to sense lines and edges. We can select which set of sensors are active by changing the pin to either or LOW.
Page 40
In previous examples we simply told Ringo to do something. In this example, we’re going to read a value from a sensor. Ringo needs to mark a location in his memory space to remember the value when it is read from the sensor. The line “declares”...
Page 41
Ringo’s right eye. You should see the value go down a bit. It should go really low if you cover Ringo in a towel or blanket that will almost completely block out the light. If you turn him toward a bright light or window, you should see this value go up.
Page 42
Using Ringo’s Light Sensors Three sensors at once... Reading one sensor is great, but if we read more than one sensor, Ringo can make better decisions based on what he sees. Let’s try an example where we read and serial print all three sensors at once. Can you guess how we would do this? #include “RingoHardware.h”...
Page 43
NeoPixel is picked up by the top side light sensor directly in front of it. If you have Ringo’s eyes lit up and want to read the light sensors, you will need to briefly turn off Ringo’s eyes before reading the light sensors.
Page 44
Ringo’s eyes are turned off. By delaying 2 milliseconds, we can be certain that Ringo is no longer seeing any “after glow” from having his eyes turned on. As soon as this delay is complete, we can go grab the three readings we want with functions.
Page 45
Gyroscope. A Gyroscope senses rotational movement. For example, if you keep Ringo in the same location but you rotate him in a turn, the Gyroscope can be used to determine how many degrees he has rotated.
Page 46
Ringo can keep up on what direction he is facing. Lucky for you, this process of reading values out of the sensors and performing the math on them (which is rather complex) has already been worked out and is performed automatically by calling a few simple functions.
Page 47
Ringo isn’t still moving from a previous motor operation, etc. Wait a second or so to calibrate after the Reset or User buttons are pressed as the presense of your finger on the robot will adversly effect the calibration accuracy.
Page 48
For example, when rotating, if Ringo needs to turn 180 degrees, the motors will run quickly at first and will slow progressivly as Ringo nears the 180 degree point. So the speed is naturally self correcting and minimizes over- shoot.
Page 49
In the NavigationBegin() main loop, we first tell Ringo to rotate 180 degress clockwise, at motor speed 200. He will attempt to reach 180 degress for 1.5 seconds. If he cannot reach 180 in...
Page 50
RotateAccurate() RotateSimple() that it moves a bit more slowly and if Ringo over-shoots the target rotation, he will reverse direction and attempt to reach the target rotation more accurately. It is prototyped as follows. char RotateAccurate(int Heading, int MaxExpectedTurnTime);...
Page 51
// go backward 300 mm delay(1000); // wait 1 second In this example, we call and tell it to drive Ringo in the MoveWithOptions() degree heading (straight ahead) at a motor speed of (motor speeds can be positive or negative to 255) for a distance of about 300 mm.
Page 52
MoveWithOptions() Ringo will make a left turn as he starts to drive because he is trying to return to degree direction. An easy way to avoid this, is to always place in place of the zero.
Page 53
Setup... As stated in the previous chapter, the LightSense lines to Ringo’s brain are shared between the top “ambient” light sensors and the bottom light sensors. To select the lower light sensors, you need to set the pin to LOW.
Page 54
Next to each light sensor is a light source that produces infrared light. This light is invisible to your eye, but Ringo’s edge sensor can see this light. All three lights are turned on and off together by setting the pin.
Page 55
“light barrier” which prevents the light from the light source from shining directly into the light sensor, so most of what the light sensor is seeing is in fact the light reflected from the surface. SKILL LEVEL Ringo Educational Guide Rev04.1 ~ Plum Geek...
Page 56
// subtract out ambient light rightDiff = rightOn-rightOff; // subtract out ambient light rearDiff = rearOn-rearOff; // subtract out ambient light // ... continued next page ... // turn the page SKILL LEVEL Ringo Educational Guide Rev04.1 ~ Plum Geek...
Page 57
800 or more. It is easy to make Ringo react in different ways to these values. For example, if you run him on a white surface and surround it with black tape, you could turn on his motors and repeatedly evaluate if the reading remains over 500, and if it ever drops below 500, you stop the motors.
Page 58
LookForEdge() returns a byte which includes 8 “bits”. Each “bit” is flipped to a 1 depending on which edge was seen and whether it was bright or dark. SKILL LEVEL Ringo Educational Guide Rev04.1 ~ Plum Geek...
Page 59
LookForEdge(). Let’s look at an example below and things will be more clear. void setup(){ HardwareBegin(); //initialize Ringo’s brain to work with his circuitry PlayStartChirp(); //Play startup chirp and blink eyes ResetLookAtEdge(); //Zeros the LookAtEdge() running average char edge;...
Page 60
//True if front Right edge sensor saw an edge RightDetected() //True if front Left edge sensor saw an edge LeftDetected() //True if a bright edge was seen BrightDetected() //True if a dark edge was seen DarkDetected() SKILL LEVEL Ringo Educational Guide Rev04.1 ~ Plum Geek...
Page 61
Ringos or other IR devices like your TV. Setup... Ringo can send IR signals through 3 different emitters which allow him to transmit 360 degrees. Each emitter may be independently enabled allowing for flexibility in how you want Ringo to communicate with other Ringos or devices around him.
Page 62
MyData “8” key on the remote. But there’s an easier way to send commands from Ringo as if Ringo was the IR remote control. Here’s how. void loop(){ TxIRKey(1);...
Page 63
Have a look at the graphic below. This shows the “key number” for each of the keys on the remote control, as well as the actual data packet sent by each key. So by passing a given key number to TxIRKey(), Ringo will send the packet corresponding to that key.
Page 64
IR Communication Receiving IR Data Ringo can be set to receive and react to data from the included IR remote control. Have a look at the code for the Pre-Loaded behavior #1, which drives Ringo around based on data received from the remote control.
Need help?
Do you have a question about the Ringo and is the answer not in the manual?
Questions and answers