User Tools

Site Tools


projects:assembly_car

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
projects:assembly_car [2013/12/19 22:51]
cgoddard [Code Implementation Process]
projects:assembly_car [2013/12/20 14:49] (current)
etappan [Files]
Line 102: Line 102:
 ==== Code ==== ==== Code ====
  
-We started our work with Assembly by simulating basic code in the Emulare AVR emulator. Once we were confident in our toolset we moved on to almost exclusively running code on the Arduino.+We started our work with Assembly by simulating basic code in the Emulare AVR emulator. Once we were confident in our toolset we moved on to almost exclusively running code on the Arduino. We used the WinAVR toolset to build our code.
  
 The basic architecture of our code is simple: we have a main loop that runs forever, reading samples from the ADC, averaging them, and then acting on the average. The snippet below shows the essence of our code, with some details removed. The basic architecture of our code is simple: we have a main loop that runs forever, reading samples from the ADC, averaging them, and then acting on the average. The snippet below shows the essence of our code, with some details removed.
Line 132: Line 132:
 </​code>​ </​code>​
  
 +Our current build is comprised of two files, robit.S and data.S. These contain our actual logic and definitions of data locations in memory, respectively.
 ==== Gotchas ==== ==== Gotchas ====
  
Line 149: Line 149:
  
 Also, make sure your documentation holds true for your particular chip. We ran into some minor trouble because we trusted a table which implied that AVR chips universally have a 2.56V internal voltage for use with AREF. This is a lie. It is also sad. Also, make sure your documentation holds true for your particular chip. We ran into some minor trouble because we trusted a table which implied that AVR chips universally have a 2.56V internal voltage for use with AREF. This is a lie. It is also sad.
 +
 +=== Sharp IR is full of liars ===
 +We found many documents alleging to have graphs comparing Sharp IR voltage readings to real distances. These were false. We had much better luck, given our application,​ reading values via an Arduino script and configuring our regimes from there.
  
 === PWM for RC Servos === === PWM for RC Servos ===
Line 154: Line 157:
  
 === Enabling Correct Motor Controller Modes === === Enabling Correct Motor Controller Modes ===
-Venom does not document very well at all. [[http://​www.competitionx.com/​pdf/​esc/​venom-pro-brushless-esc-manual.pdf|This]] is not the electronic speed control (ESC) for our car. The programming is at least similar enough to let our car goes backwards. If it is not in the correct mode, the car will only be able to go forwards. How can you go two steps forwards without at least one back? You can't.+Venom does not document very well at all. [[http://​www.competitionx.com/​pdf/​esc/​venom-pro-brushless-esc-manual.pdf|This]] is not the electronic speed control (ESC) for our car. The programming is at least similar enough to let our car go backwards. If it is not in the correct mode, the car will only be able to go forwards. How can you go two steps forwards without at least one back? You can't.
 ==== Hardware Implementation ==== ==== Hardware Implementation ====
 +{{http://​cdn.instructables.com/​FTX/​AGWD/​H05NT69Z/​FTXAGWDH05NT69Z.LARGE.jpg?​200 }}
 Our robot is a Frankenstein of several components: an RC car chassis, an Arduino Uno, and two IR range-finder sensors. Our robot is a Frankenstein of several components: an RC car chassis, an Arduino Uno, and two IR range-finder sensors.
  
-The chassis we used as a [[http://​​www.horizonhobby.com/​​products/​​venom-creeper-rock-crawler-kit-1-10-green-electric-VNR8300GR#​​t1|Venom Creeper Rock Crawler]]. It was originally set-up to be controlled by RC, but we simply disconnected the motor controller and steering servo from the receiver ​and wired it to our Arduino ​to mimic the PWM signal and control ​the car autonomously. ​We used an [[http://​​arduino.cc/​​en/​​Main/​​ArduinoBoardUno|Arduino Uno]] with its [[http://​​www.atmel.com/​​Images/​​doc8161.pdf|AtMega328 microcontroller]]. 90% of the information on the Arduino board is irrelevant if you're just using it as a platform for the AtMega but the schematics are there. The most significant detail is the connection between the raw AtMega pins and the I/O pins of the Arduino.+The chassis we used as a [[http://​​www.horizonhobby.com/​​products/​​venom-creeper-rock-crawler-kit-1-10-green-electric-VNR8300GR#​​t1|Venom Creeper Rock Crawler]]. It was originally set-up to be controlled by RC, but we simply disconnected the motor controller and steering servo from the receiver. By wiring ​it to our Arduino ​we could mimic the PWM signal and run the car autonomously. ​We used an [[http://​​arduino.cc/​​en/​​Main/​​ArduinoBoardUno|Arduino Uno]] with its [[http://​​www.atmel.com/​​Images/​​doc8161.pdf|AtMega328 microcontroller]]. 90% of the information on the Arduino board is irrelevant if you're just using it as a platform for the AtMega but the schematics are there. The most significant detail is the connection between the raw AtMega pins and the I/O pins of the Arduino.
  
-To sense the world around it to detect obstacles, we mounted two [[http://​​zuff.info/​​SharpGP2D12_E.html|Sharp GP2D12 IR range-finding sensors]] to the front of the robot. Some important characteristics are that it has a 40ms update period, so we need to do our averaging only with new values, not when we query it at a the high-rate we do. Also, the analog voltage is inversely proportional (in a non-linear fashion) to the distance values. It has the following range and mapping: max 2.45V = 10cm and min 0.45V = 80cmwith an error of 200mV.+To sense the world around it to detect obstacles, we mounted two [[http://​​zuff.info/​​SharpGP2D12_E.html|Sharp GP2D12 IR range-finding sensors]] to the front of the robot. Some important characteristics are that it has a 40ms update period, so we need to do our averaging only with new values, not when we query it at a the high-rate we do. Also, the analog voltage is inversely proportional (in a non-linear fashion) to the distance values. It has the following ​alleged ​range and mapping: max 2.45V = 10cm and min 0.45V = 80cm with an error of 200mV. In practice, it was necessary to check values manually via an Arduino script.
  
 {{ :​projects:​img_3395.jpg?​400|}} {{ :​projects:​img_3395.jpg?​400|}}
Line 166: Line 170:
  
 Mounted IR range-finding sensors using the sophisticated wonders of tape and cardboard. ​ Mounted IR range-finding sensors using the sophisticated wonders of tape and cardboard. ​
- 
-{{http://​cdn.instructables.com/​FTX/​AGWD/​H05NT69Z/​FTXAGWDH05NT69Z.LARGE.jpg?​200 }} 
  
 We used an [[http://​arduino.cc/​en/​Main/​ArduinoBoardUno|Arduino Uno]] with its [[http://​www.atmel.com/​Images/​doc8161.pdf|AtMega328 microcontroller]]. 90% of the information on the Arduino board is irrelevant if you're just using it as a platform for the AtMega but the schematics are there. The most significant detail is the connection between the raw AtMega pins and the I/O pins of the Arduino. We used an [[http://​arduino.cc/​en/​Main/​ArduinoBoardUno|Arduino Uno]] with its [[http://​www.atmel.com/​Images/​doc8161.pdf|AtMega328 microcontroller]]. 90% of the information on the Arduino board is irrelevant if you're just using it as a platform for the AtMega but the schematics are there. The most significant detail is the connection between the raw AtMega pins and the I/O pins of the Arduino.
Line 197: Line 199:
   * [[http://​emulare.sourceforge.net/​debugging%20with%20emulare%20and%20insight.php | Debugging with Emulare]]: Emulare is an AtMEGA simulator. While it doesn'​t have many bells or whistles it's useful for confirming basic features of your assembly work. Can be used with assembly debugging tools such as those bundled with WinAVR.   * [[http://​emulare.sourceforge.net/​debugging%20with%20emulare%20and%20insight.php | Debugging with Emulare]]: Emulare is an AtMEGA simulator. While it doesn'​t have many bells or whistles it's useful for confirming basic features of your assembly work. Can be used with assembly debugging tools such as those bundled with WinAVR.
   * [[http://​www.nongnu.org/​avr-libc/​user-manual/​using_tools.html | Building Assembly]]: Exactly what you'd expect.   * [[http://​www.nongnu.org/​avr-libc/​user-manual/​using_tools.html | Building Assembly]]: Exactly what you'd expect.
 +  * [[http://​extremeelectronics.co.in/​avr-tutorials/​timers-in-compare-mode-part-i/​ | AVR Timers]]: This series of articles is a good resource for timers and PWM in AVR. Read as far back as you need to given your application.
 ==== Files ==== ==== Files ====
 +{{:​projects:​CompArchRobit.zip}}:​ A .zip archive with all of our assembly. robit.S is our main working build. Similarly-named files are backups of partially functional builds or else broken test builds. Running the following from a command line/prompt will build and deploy robit.S on Com10. Change the flash.bat file as needed to reflect the actual Com Port in use.
 +<​code>​
 +> cd "​CompArch Robit"
 +> make
 +Yes. Done. Good. :)
 +> flash
 +[...So much output... Holy cow...]
 +</​code>​
 +
 +{{:​projects:​Robit_Movie.zip}}:​ An early example of the car in motion. Later builds were less likely to capsize.
projects/assembly_car.1387511463.txt.gz · Last modified: 2013/12/19 22:51 by cgoddard