manualshive.com logo in svg
background image

 

Ringo Educational Guide Rev04.1 ~ Plum Geek

Ringo Educational Guide

Содержание Ringo

Страница 1: ...Ringo Educational Guide Rev04 1 Plum Geek Ringo Educational Guide...

Страница 2: ...ts 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 W...

Страница 3: ...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 beca...

Страница 4: ...Reset Button This button connects to a special pin on Ringo s brain Whenever pressed it will halt Ringo s processing and when released Ringo will startup fresh from the beginning of his program This...

Страница 5: ...ws Ringo to charge through the Programming Adaptor Normally this should be left in place It is however occasionally useful to remove this jumper As the battery in Ringo reaches its maximum charge leve...

Страница 6: ...nux 32 bit 64 bit 1 In order to program your Ringo you ll need to download the newest version of the Arduino software first from www arduino cc it s free This software known as the Arduino IDE will al...

Страница 7: ...nal Guide Rev04 1 Plum Geek 2 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...

Страница 8: ...n 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 Red Stripe on Cable Turn swi...

Страница 9: ...time Warning Take care to not bend the pins when handling Ringo or attaching the programming cable TIP You don t need to press the ribbon cable all the way onto Ringo s programming pins Normally it l...

Страница 10: ...ctive sketch Note the sketch is not saved automatically when uploading or verifying Serial Monitor This will open a window that display any serial information your Ringo is transmitting It is useful f...

Страница 11: ...t Archive Sketch Fix Encoding Reload Serial Monitor dev tty usbmodem262471 dev cu usbmodem262471 dev tty Bluetooth Modem dev cu Bluetooth Modem dev tty FireFly 7256 SPP dev cu FireFly 7256 SPP dev tty...

Страница 12: ...examples You will need to place the three library folders RingoMsTimer2 RingoWire and Adafruit_NeoPixel into your Arduino libraries folder You will also want to place the Ringo_Examples folder into y...

Страница 13: ...uit_NeoPixel Copy the three folders RingoMsTimer2 RingoWire and Adafruit_NeoPixel into Arduino s folder named examples Find Arduino in your applications folder Right click ctrl click on Arduino Select...

Страница 14: ...a tabs hide the background functions used by Ringo Rather than install them as a library in which case they wouldn t appear as tabs we ve included them with each sketch so more advanced users can easi...

Страница 15: ...write or edit in the Arduino IDE The important parts of the code in a given example are highlighted in purple Opening Heading This area includes basic information about the program It is not actually...

Страница 16: ...re more than one line to write There s a solution for that You can begin a comment block with a forward slash followed by a asterisk Then you can write as many lines of comment as you like You then en...

Страница 17: ...go or until his battery runs too low and he shuts off automatically The loop function is where the bulk of you program usually lives void setup HardwareBegin initialize Ringo s brain to work with his...

Страница 18: ...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 applicable to Ringo Arduino Course for Absolu...

Страница 19: ...s We owe them a huge high five for writing the code required to communicate with these awesome little lights Each light can have each of its red green and blue LEDs set to any level between 0 and 255...

Страница 20: ...in project page above the line void setup Like this This include line will insert the RingoHardware h file which itself includes a special line include Adafruit_NeoPixel h By including RingoHardware h...

Страница 21: ...ngo s brain to target the pixel at address 3 The next three numbers tell the pixel at address 3 how bright to turn on the red green and blue lights inside the pixel In this case the red is set to 0 so...

Страница 22: ...red or green or blue Like PLUM You can easily create different colors by mixing different amounts of the three primary colors Red Green and Blue Try this example code Compile it load it and observe wh...

Страница 23: ...his brain will usually remain active even during current limit When the current limit is engaged you will see the pixels and other current limited parts stop working or behave in strange ways This is...

Страница 24: ...xels use this function to resume pixel operation If you spend more than five minutes learning how to code you will find your patience tested Writing code is really pretty simple but there is a small c...

Страница 25: ...50 90 curley braces are wrong no workey SetPixelRGB 1 120 50 90 brackets are wrong no workey SetPixelRGB 1 120 50 90 correct semi colon This works SetPixelRGB 1 120 50 90 oops no semi colon upset comp...

Страница 26: ...run this code Experiments Challenges void loop SetPixelRGB 4 255 255 255 set pixel 4 Right eye SetPixelRGB 5 255 255 255 set pixel 5 Left eye RefreshPixels Woah That s BRIGHT Now take Ringo into a da...

Страница 27: ...o call the RefreshPixels after running it This function is most useful for turning off all the NeoPixel lights at the same time Occasionally if Ringo is reset or the User button is pressed during a co...

Страница 28: ...nt with these on your own and you ll get the hang of using them OffPixels turns off all pixels OffPixel Address turns off a specific pixel OnEyes Red Green Blue makes eyes the given color LeftEye Red...

Страница 29: ...es have sensors to see the edges of tables but he won t respond to them unless your code specifically tells him to do so We ll get to that eventually but these simple examples do not automatically loo...

Страница 30: ...driving forward Then we tell his brain to wait one second with delay 1000 so he will drive forward for one second Then we set both of Ringo s motors to speed 0 with the command Motors 0 0 which makes...

Страница 31: ...o move forward and the other motor to move backward Try using this command to set motor speed Motors 200 200 What happens This is causing the left motor to move at speed 200 in the forward direction a...

Страница 32: ...uld be turning at the same speed right You would think Ringo would have been driving in a perfectly straight line but I m guessing he didn t though you may have gotten lucky this time and perhaps he d...

Страница 33: ...n most robots require some way of sensing how they are moving Wouldn t it be smart if Ringo could somehow know that he was starting to veer to the right and automatically adjust the speed of his motor...

Страница 34: ...straight on to Ringo while he is on a surface Look at the areas with the purple circles There should be a gap of about 1mm between the running surface and the lowest portion of Ringo s motor clip If...

Страница 35: ...afts especially hair from your pets when he is run on the floor Usually this is easy to remove Using tweezers carefully pluck the hair off the shaft by rolling the shaft with your fingers A bit of hai...

Страница 36: ...nd motor functions in the previous example and didn t even realize it Let s look at an example PlayChirp Frequency Amplitude You pass a frequency which is the pitch of the tone to be played in hertz A...

Страница 37: ...r main loop function and see what happens 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 th...

Страница 38: ...reate interesting effects Like this Ringo should be playing the C Major chord every second If you work with the notes and timings it is possible to make Ringo play simple songs void loop PlayChirp NOT...

Страница 39: ...has three inputs that can read the analog light sensors However there are actually six light sensors on Ringo s body there are the three ambient light sensors on the top side and there are also three...

Страница 40: ...sson Let s load up the following code example and see what happens 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 ma...

Страница 41: ...d see this value go up You may notice a few interesting things First it is impossible to bring this value all the way down to zero This is beyond the scope of the lesson but the light sensor always le...

Страница 42: ...rint sensorRear print sensorValue through serial port Serial println print a blank line feed Serial println print a blank line feed delay 250 delay 250 milliseconds Three sensors at once Reading one s...

Страница 43: ...eye lights are turned off then the light sensors are read then the eye lights are turned back on immediately following it will appear that Ringo s eyes were lit up the entire time Try this code and s...

Страница 44: ...ger 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 analogRead functions As soon as the readings are complete we f...

Страница 45: ...l 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 Taken together these sensors embody an...

Страница 46: ...ertain speed and that taken over time can determine distance If the sensor data isn t read out every 80 milliseconds the memory inside the sensor called a buffer will overflow The overflow doesn t hur...

Страница 47: ...Vibrations or wiggles on your table will adversly effect the calibration The sensors should be recalibrated every so often Keep in mind that it is useful to place a delay before each calibration to m...

Страница 48: ...s Ringo to perform a turning movement or rotation It is not quite as accurate as the next rotation example but will arrive at the target rotation a bit more quickly The function takes five arguments a...

Страница 49: ...stop immediately He will skid on the surface for some period of time Once the motors are turned off Ringo will continue to evaluate his gyroscope and wait for the readings to indicate that he has in f...

Страница 50: ...st argument is Direction Ringo will attempt to turn to this direction as he begins driving Speed is the average motor speed he should try to maintain This will be adjusted up or down slightly between...

Страница 51: ...an be positive or negative 0 to 255 for a distance of about 300 mm He will allow 2 seconds to complete the maneuver allow 100 milliseconds to come to a complete stop after the maneuver and he ll do it...

Страница 52: ...s he starts to drive because he is trying to return to the 0 degree direction An easy way to avoid this is to always place GetHeading in place of the zero The GetHeading function reads Ringo s current...

Страница 53: ...ntended to work together with three infrared light sources placed near the three light sensors Setup As stated in the previous chapter the LightSense lines to Ringo s brain are shared between the top...

Страница 54: ...sent a couple super easy functions that automate the edge detection process How edges are measured The edge sensors are just light sensors mounted to Ringo s bottom side If Ringo is placed on a white...

Страница 55: ...use each surface will reflect a different amount of light this difference value can be evaluated and we can draw some assumptions about the surface from the difference value Darker surfaces will refle...

Страница 56: ...talWrite Edge_Lights HIGH turn on the IR light sources delayMicroseconds 200 let sensors stabilize leftOn analogRead LightSense_Left read sensors w IR lights on rightOn analogRead LightSense_Right rea...

Страница 57: ...ke a short time for the sensor to stabilize to the new input level After we let the sensors stabilize to the new light level we read each of them We then do the same process after turning off the IR l...

Страница 58: ...to determine if the left edge sensor has recently moved to a surface that is brighter or darker compared to the running average You can call LookAtEdge by itself on your own if you like Now lets get...

Страница 59: ...e average determine if if any edges were seen place the coded binary result in the variable edge This edge variable will be zero if no edge was seen if FrontEdgeDetected edge do something if either fr...

Страница 60: ...quick list FrontEdgeDetected True if either front edge sensor saw an edge BackEdgeDetected True if the rear edge sensor saw an edge RightDetected True if front Right edge sensor saw an edge LeftDetect...

Страница 61: ...Ringo to communicate with other Ringos or devices around him digitalWrite IR_Enable_Front HIGH Enable Front IR source digitalWrite IR_Enable_RearLeft HIGH Enable RearLeft IR source digitalWrite IR_En...

Страница 62: ...cation using the 3 IR sources The supplied remote control sends packets of 4 bytes each time a key is pressed so it is suggested that any IR communication use packets containing 4 bytes of data You ca...

Страница 63: ...akes the reception of the packet somewhat spotty It seems the Arduino delayMicroseconds isn t accurate enough to reliably time the packets We would welcome any help from the user base to have a look a...

Страница 64: ...ll this function the IR receive functions run in the background You don t need to do anything else to actually receive data When a 4 byte packet has been received IsIRDone will return a non zero which...

Отзывы: