Knex Robot Car



Knex Robot CarA Makers GuideOverview400240535560The K'nex Robot Car is designed to enable primary school children to learn the basic concepts of programming by enabling them to build a robot of their own design and send a sequence of simple instructions for it to follow. An Intel Galileo gen 2 board is used to provide a private wifi hotspot that serves up interactive web pages using websockets protocol, to enable remote operation from a laptop, tablet or phone browser. From there the children can write their commands and send them to the robot for execution. A modified Adafruit v2 motor shield is used to drive the standard K'nex motors, together with ancillary circuits to regulate motor power and provide a battery test facility. All the electronics and batteries are housed in a case to make it robust enough for the school environment with external connectors provided for motors and sensors wired for compatibility with Grove devices.Basic HardwareThe original design includes a number of extra features that are not strictly required in order to build the basic Robot Car. These are marked below with ** and links to the detailed design which you can follow if you prefer.Basic Parts List:(**Full Parts List here)Intel Galileo gen2Adafruit Motor shield v21xmicro SD card 4GB min (original made using 16GB)Batteries6 x rechargeable AA batteriesBattery holder for 6 AA & clip to connect to boardDC power jackWiFiIntel Centrino Advanced-N 6235 WiFi PCIEx1 card (should also work with N135 or 6205)Full size to half size mini PCIE bracket2x Antenna with RP-SMA female connectors2x U.FL to RP-SMA cablesHardware4x standoffs to mount in each corner of the Galileo boardSmall bracket to mount the Antenna on2x Knex motorsKnex to build your robot carBasic Assembly:(** Full Assembly Instructions here)Screw the stand offs into the four corners of the Galileo board so that it stands clear of the work surface.397827536195The Adafruit v2 Motor Shield is supplied with headers that must first be soldered into place to enable the shield to plug into the top of the Galileo board.Plug the Motor Shield onto the GalileoSolder the DC jack onto the battery clip. Take care to solder the red wire to the centre pin of the jack and the black to the outer side of the jack as reverse polarity may damage your Galileo and/or shield.Solder a wire onto the battery pack to take a tap off at 3.6V and a second wire to ground for use with Knex motorsScrew the mini PCIE bracket onto the Intel Centrino wireless card and insert the resulting module into the underside PCIE socket on the Galileo.400240540005Attach both U.FL to RP-SMA cables to the Centrino card and to the Antenna on the other end of each cable.Wire the motors to the M1 (left motor) and M2 (right motor) screw connectors on the Adafruit shield.Wire the 3.6V tap from the battery holder to the Adafruit shield Motor supply + screw connector. (Warning - test to make sure you have the right voltage tap from the battery connector and that you are applying +3.6V to the + connector and not the ground connector beside it!)Wire the Ground tap from the battery to the Adafruit shield motor supply - screw connector. SoftwareDownload the SD card image from the web site here. It contains everything you need including the pre-loaded sketch to run the Robot Car.Copy the files onto the micro SD using your computer.Insert the SD card into the Galileo.400240527940186372527305Knex Robot Car433387579311518637251133475These photographs show the construction of the Knex Robot Car. The design can of course be changed but if the wheel size or distance between the wheels is changed then the calibration and maybe the software would need to be modified in order for the robot to turn exactly 90 degrees.39630351232535OperationInsert 6 fully charged rechargeable AA batteries into the battery holder taking care to ensure they are inserted the right way around! The battery taps should be connected to the motor shield as described in the last section.First try the Galileo running from its mains adaptor (with the battery taps connected to the motor shield). Keep the wheels in the air to avoid pulling on the mains adaptor wire.Insert the DC jack into the the Galileo board and wait for it to boot up (1-2minutes). Using a laptop or tablet scan for available wifi hotspots - you should see an open one called Edushield being broadcast by the Galileo - connect to this.Once connected it will say there is a limited connection - this is normal as the Galileo is configured to only provide a hotspot and not to connect to the internet.Start a recent version of Chrome browser (v34 or above) on your laptop or tablet and browse to - you should then see the interface screen.To program the Robot Car, enter Forward, Back, Right, Left or Pause using the direction keys on the left hand side. Instructions will then appear in order on the right hand side.Pressing Run should start the Robot moving in accordance with your instructions and will be highlighted in green once each action is completed so you can follow the program.Once the Robot Car has been shown to work on its mains adaptor it is time to go mobile. Attach the battery clip to the batteries and test the DC jack to ensure that you have a voltage of about 7.2-8.4V with the centre of the jack positive.Unplug the Galileo mains adaptor jack and replace with the jack from the batteries and follow steps 3-8 above and refer below for more detail on how t use the mand Options:Forward Arrow-Move forward 20cmBack Arrow -Move back 20cmRight Arrow-Turn right 90 degreesLeft Arrow-Turn left 90 degreesPause-Pause for 1 secondHeadlights-Toggle headlights on or off each time command used **Horn-Sound horn **Red LED-Toggle red LED on shield on or off each time command used **Yellow LED- Toggle yellow LED on shield on or off each time command used **Green LED-Toggle green LED on shield on or off each time command used **** These commands only work if you have built the full version of the boardControl OptionsRun-Start running the program from the top of the tableStop-Stop the currently running program after current instruction completedReset-Change "Completed" status on each command to be "Not Started"Clear Table-Clears the current table of commands (confirm ok to accept)Back-Move back to last pageCalibrate-Pop-up enables calibration of Robot Car to move more accuratelyCalibration Pop-Up screenNote that new calibration values are only saved when Test is pressed. Ll values are kept on the SD card and will be remembered after a cold boot. Values for each slider are arbitrary numbers between -100 and +100 representing small changes to the Robot Car movement.It is recommended to always calibrate Balance Trim first.Balance Trim-Slider biases direction to left or right - press Test and Robot Car will move forward 1.6 metres. If the car drifts right or left this can be corrected by altering the slider to compensate and testing again. Forward/Back TrimAdjust the slider and press Test to ensure the Robot Car moves forward/back 20cmRight/Left Trim- Adjust the slider and press Test to ensure the Robot Car moves right/left 90 degrees. Note the Test button causes the robot to go forward 20cm and then right or left and then forward 20cm again.You should now have a fully working system! If you would like more details on the full prototype design and how it works, read on!-----------------------------------------------------------------------------------------------------------------------------------------------------Full Version - Overview4002405-3810The full version of the Knex Robot Car adds some key features to the basic design explained previously to make it more suitable for children to learn and explore and provide expansion options to use the system in other lessons throughout the school.The Galileo, shield, batteries and other circuits are all contained in a strong enclosure to avoid damage through handling.A power socket is provided for the standard Galileo mains DC jack and a switch enables the system to be powered from mains or internal batteries.To enable a quick test of the batteries before use a small push button is located on the front. When pressed LEDs indicate how well charged the batteries are (Yellow+Green = Full charge, Yellow=Good, No LED= time to recharge). This is especially useful in a classroom environment where several systems may be in use at once.Phono/RCA Sockets are provided for up to 4x DC motors (or two stepper motors) avoiding the risk of incorrect wiringRJ11 connectors provide access to I/O 0,1,2,3 Analogue 2,3 and I2C bus with VCC and Ground available on each socket. These are wired the same as sensors and actuators from Grove making it easy to connect their devices with a suitable adaptor.Internally there is a stabilised supply for the Motor Shield derived from either mains power or batteries. This helps to maintain the accuracy of the Robot Car as batteries discharge.Additions have also been made to the Adafruit Motor Shield in the prototyping area to provide 2x push switches, 3xLEDs, 1 Light Dependent Resistor, 1x Tilt swicth and an LCD display. The purpose of these components is to provide a basic framework of sensors and actuators which can be used by older students which can be extended via the external RJ11 sockets.Full Parts List:Intel Galileo gen2Adafruit Motor shield v23 x LEDs (Red, Green, Yellow)3 x 300Ω resistors2 x Push buttons (push to make, release to break)1 x tilt switch 3 x 10kΩ resistors1 x 10kΩ potentiometer1 x Light dependent resistor1 x 3.3kΩ resistor2 x 5 way headers as used to connect shield to GalileoWire to connect up components on shield prototyping area (wire wrap wire used on prototype)Battery tester, stabilised motor supply and power componentsThree position double pole slide switch - on-off-onPrototyping breadboard with copper plated solder pads around each hole1 x DC power jack socket1 x Push button (push to make)LM317 variable stabilised voltage regulator1 x 220Ω resistor1 x 1kΩ variable resistor1 x 100uF capacitor1 x 10uF capacitor1 x 0.1uF capacitor1 x 1N4001 diodeLM339 quad comparator2 x LEDs (Yellow, Green)2 x 220Ω resistors1 x 3V Zener diode1 x 330Ω resistor1 x 56kΩ resistor1 x 2k7Ω resistor1 x 33kΩ resistor2 x 1kΩ resistor2 x 1MΩ resistor1xmicro SD card 4GB min (original made using 16GB)Batteries6 x rechargeable AA batteriesBuilt-in battery holder for 6 AADC power jack socketWiFiIntel Centrino Advanced-N 6235 WiFi PCIEx1 card (should also work with N135 or 6205)Full size to half size mini PCIE bracket2x Antenna with RP-SMA female connectors2x U.FL to RP-SMA cablesExternal Hardware4x standoffs to mount in each corner of the Galileo board150x80x50mm Translucent Blue Polycarbonate Box4x Phono/RCA sockets for motors4 port RJ11 sockets for sensors3 position slide switch (on mains/off/on batteries)Micro push button for battery test facility4 x 0.1uF capacitors to reduce noise on external connector power railsComponents for modifications to shield…..2x Knex motorsKnex to build your robot carFull Assembly (refer to circuit diagrams and external socket diagrams)433641520320Screw the stand offs into the four corners of the Galileo board so that it stands clear of the work surface. (You may need to adjust the length later on to fit in the enclosure whilst leaving room for the batteries underneath)..Adafruit v2 Motor Shield Solder the supplied headers into place to enable the shield to plug into the top of the Galileo board. Using the prototyping area on the shield, solder the push buttons, potentiometer , LEDs, LDR, Tilt Switch, Resistors and two 5 way headers for external connectors into place, wiring them up using the circuit diagram. 4002405127635Battery tester, stabilised motor supply and power componentsCut the breadboard to size to fit in the desired position within the caseSolder the slide switch, push button, DC jack socket, LM339, LM317 onto the top of the breadboardFor space reasons the remaining components were soldered underneath the board and wired by soldering with fine wire wrap - referring to the circuit diagram below.Solder wires onto the board to the DC power jack, battery connector and motor supplyTest the circuit (without connecting it to the Galileo) to ensure that the correct voltage and polarity are reaching the DC power jack. Put recharegable batteries in the battery holder and slide the switch to the battery position. Measure the voltage at the DC power jack plug - you should see a voltage of around 7.2-8.4V assuming a set of six charged batteries, with the centre pin positive.Plug the Galileo mains adaptor into a socket on the wall and put its power jack into the DC power socket, then slide the switch across to the mains adaptor setting.Measure the voltage on the internal DC power jack - you should see a voltage of about 12V with the centre pin positive.Finally if you push the battery test button both LEDs should light up for a battery voltage above 7.9V, For voltages between 7.15 and 7.9 just the yellow LED will light. Below 7.15V no LEDs will light indicating that the batteries need to be recharged.Assembling the enclosureTest fit the Galilo in the enclosure and mark out where to cut to provide access to the two USB and Ethernet sockets. Also mark holes in the underside lining up with the four stand offs on the board.Similarly test fit the Battery tester and motor supply board and mark out where to cut for slide switch, DC power socket and battery test push button.Mark holes for the wifi antenna, 4 phono/RCA sockets and 4 port RJ11 sockets.Mark out a hole in the bottom to accept the battery holder.Mark holes in the lid to allow access to the push buttons and potentiometer on the shieldCut out all holes and adjust to fit.Glue the 4 port RJ11 socket into place and screw in the four phono/RCA socketsAttach the wifi antenna cables/sockets to the end of the enclosure400240530480Internal wiringSolder wires onto the 4 port RJ11 connector using the circuit diagram for reference. On the other end of the RJ11 wires, solder a pins to insert into the two 5 way headers soldered to the underside of the shield.Solder wires onto the four phono/RCA sockets to lead up to the motor screw connectors on the shield.Final assembly400240589535Insert the battery holder into the underside of the enclosure and position the Battery tester and motor supply circuit board to align with holes in the enclosure.Position the Galileo board into the enclosure and screw into place using the other end of the standoffs to secure the board to the base of the enclosure.Connect the DC jack from the battery tester, motor supply and power board into the Galileo board.4010025139065Add the shield and connect the pins from the RJ11 ports to the 10 way header under the shield.Connect the phono/RCA wires to the four motor terminals (M1-M4) on the shield. (If you find the motors work in reverse to that expected, swap the wires over.4010025570230Connect the motor supply wires (+ and ground) from the battery test and motor supply board to the motor supply screw terminals on the shield.External devicesWire each Knex motor to a phono/RCA plug with the white stripe wire going to the centre pin. These can then be plugged into the phone/RCA sockets on the enclosure.The RJ11 ports provide the same signals and power as the Grove range of sensors. Therefore it is possible to make up an adaptor cable with an RJ11 plug on one end and a Grove connector on the other to allow different sensors to be plugged in.The software includes the ability to switch on headlights and sound a horn. This is achieved by wiring a cable with an RJ11 plug on one end (plugged into the I/O 2/3 RJ11 socket) and two LEDs and a piezo speaker on the other. (Refer to the circuit diagram for more detail).SoftwareDownload the SD card image from the web site here. It contains everything you need including the pre-loaded sketch to run the Robot Car.Copy the files onto the micro SD using your computer.Insert the SD card into the Galileo and then switch on.OperationOperation is as described earlier.Software OverviewFor those interested in adapting the software for their own uses, the following provides some information to help. This project was developed using the same approach as the Intel Connectanything code and shares a number of dependencies.Galileo code (backend8_1.ino) outline:Updates the calibration array from the SD cardStarts an access point script StartAP on the root of the GalileoInitialises Websockets to allow bidirectional asynchronous data transfer with clientLoop() continuously checks flags to see if any execution is required eg:Move motors, light LEDs or make a soundUpdate calibration data and save to SD cardIf a websocket request is detected one of the following actions occursServe up a web page from the SD card (note must be on white list in code)Command from web site received - set flag for loop() to respond toIf a websocket can be sent to the client thenCheck if a command confirmation is due to be sent and if so, send itAll data is sent and received using aJson which provides a method for standardising data structureEnvironmentIn order to recompile and change the code there are a few changes that need to be made to the standard setup as follows (assuming the Galileo already has Knex Robot Car SD card image loaded).Install the Adafruit Motor v2 from the Adafruit web site The Adafruit Motor library requires a small change to the Adafruit_MotorShield.cpp file contained in the library - comment out the lines as shown below near the top of the file. The reason is that Adafruit software assumes that if the board does not respond as an Arduino Uno, it must be a Due. However the Intel Galileo requires a standard Uno interface. (Notepad++ is a good free editor for this step).//#ifdef __AVR__ #define WIRE Wire//#else // Arduino Due// #define WIRE Wire1//#endifDownload the Knex Robot Car source files here.Install the aJson and libwebsockets libraries via the Galileo IDEFind the libwebsockets library folder and follow these instructions:Copy libwebsockets.so and libz.so to : arduino-1.5.3-Intel.1.0.3\hardware\tools\x86\i586-poky-linux-uclibc\libFind platform.win.txt in arduino-1.5.3-Intel.1.0.3\hardware\arduino\x86 and rename it old.platform.win.txtCopy the platform.win.txt from the folder arduino-1.5.3\hardware\tools\x86\i586-poky-linux-uclibc\lib to arduino-1.5.3-Intel.1.0.3\hardware\arduino\x86 Note: Revert to the normal platform.win.txt if you don't use the libwebsockets libraryA useful free tool to provide wireless access to the Galileo when running the Knex Robot Car software (or Intel's Connectanything) is WinSCP. Provided you have the SD image on the Galileo up and running, this enables you to log into the Galileo remotely and move files between your PC and the Galileo - eg to update the front end web pages. There is also a terminal client that enables you to access the Linux command line. Use the following login credentials:File Protocol: SCPHost name: 192.168.0.10User name: root(no password)Click login to beginSerial.print is used throughout the program to provide updates and debug info on data transfer between the Galileo and the client. To view these plug the USB cable from your PC into the Galileo, start the IDE and press <ctrl><shift>M to start the serial monitor. If you refresh the client browser you should see a stream of files being served to the client.Known bugsThe system only works with recent Chrome browsers and more front end coding is required to take account of other browsersSimilarly the code does not scale to smaller screens.Numbers in the calibration screen only show up when the slider is movedI/O TableI/O PinFunction5, 6, 9Red, Yellow, Green LEDs (HIGH = on)0,1,2,3External digital I/O on RJ11 sockets 1 (pins 3 & 4) and 2 (pins 3 & 4).White LED headlights and horn use external I/O 2 and 3 respectively4, 7Switch 1 and 2 (LOW = button pushed)8Tilt switch (LOW = tilted)10-13Not usedA0, A1External Analogue I/O on RJ11 socket 2 (pins 3 and 4)A2Light dependent resistorA3PotentiometerExternal Sockets & Controls5V SDA SCL Gnd5V A0 A1 Gnd5V IO2 IO3 Gnd5V IO0 IO1 Gnd123456123456123456123456RJ11: Wiring view looking into sockets - note pins 1 & 6 not used.M1 M2 M3 M4Phono Sockets:AntennaBattery TestDC InBat Off MainsEnd Panel:When Battery Test button pushed, Yellow+Green LED = Freshly charged batteries, Yellow = Batteries good, No LEDs = time to recharge batteries.Back to Full InstructionsShield Circuit diagrams300Ω300Ω300ΩGnd5VSw1Sw210KΩ10KΩGreen LEDRed LEDYellow LEDI/O 7I/O 4I/O 9I/O 6I/O 5LEDsPotentiometerLight Dependent Resistor10KΩLDR3K3ΩA3Gnd5V5VGndA2Header to RJ110.1uF0.1uF0.1uF0.1uFA0GndSCLSDAA1I/O 1I/O 05VI/O 3I/O 2123456123456123456123456Header to RJ11SwitchesBack to Full InstructionsInternal DC Jack to GalileoBattery Test switch1930405083810213111054123220Ω220Ω1MΩΩ1MΩ33KΩ2K7Ω56KΩ3V Zener330Ω+--+LM339Stabilised Motor Power CircuitBattery Test CircuitBattery Holder3692553473897831940503326130-1327153595370DC In Jack Socket forexternal power supplySlide switchPower to centre pinMotor Supply -Motor Supply +1KΩ240Ω0.1uF10uF100uF1N4001LM317Battery Test, Motor Supply and Power Circuit Diagrams1KΩ1KΩYellowLEDGreenLEDBack to Full Instructions123456300ΩRJ11 Plug rear viewPiezoSpeakerWhiteLEDs300ΩExternal Headlights & Horn Wiring3391357845871NCBack to Full Instructions ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download