Go Down

Topic: Science Olympiad (2016-2017) Electric Vehicle (Read 830 times) previous topic - next topic


Hello, I was wondering if anyone could help us design a specific code for an electric vehicle that needs to go a specific distance at certain time intervals for the science olympiad competition. For instance, if the distance required was 5m how can I design a code that the vehicle would travel and stop at the certain distance after a certain amount of time. We have the basis of the vehicle already built. It has 4 individual motors which need to be connected to the arduino uno. (I will include the links down below for vehicle and motor). Please somebody help us. :) And if any more specific details are needed I will provided them immediately.
Thank You
Desperate High School Student


Arduino Uno:
https://www.amazon.com/Arduino-Uno-R3-Microcontroller-A000066/dp/B008GRTSV6/mref=pd_bxgy_21_img_3?_encoding=UTF8&pd_rd_i=B008GRTSV6&pd_rd_r=ZHH2H6PJJJW0GCYM63VG&pd_rd_w=xUlQR&pd_rd_wg=15UB   j ge&psc=1&refRID=ZHH2H6PJJJW0GCYM63VG

Microcontroller Shield:


Jan 08, 2017, 10:58 pm Last Edit: Jan 08, 2017, 11:24 pm by AWOL
How do you propose to measure 5m?
Once you've got that sorted, the code should be simp!e.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.


That's what I need to figure out myself. Haha. Would it be better to test the distance my vehicle travels in a certain amount of time? And then afterwards the amount of time it takes for my vehicle to travel my desired distance that's when I'll cut off the power to the motor. Again I'm completely new to this so forgive me if I sound completely ignorant.


Look at the datasheet for the motor. Based on the amount of current, the rpm will be different. You can use the rpm and the circumference of the wheel, along with some testing to determine the amount of time it will take to make the vehicle move 5m.

Here is some example code:

Code: [Select]

void setup{
pinMode(13, OUTPUT);
void loop{
digitalWrite(13, HIGH);
digitalWrite(13, LOW);

Use a voltmeter, preferably digital, to measure the power going into each motor.

Remember to put the motors in parallel, but if the vehicle needs the wheels to be able to go backwards and forwards, use an H-Bridge, with pin 13 as + and GND and -. Since there are multiple motor, instead of one motor, put all of the motors there in a parallel circuit.

Oh, and by the way, good luck!


Thank you so much!!! Just as a question, how would the example code for the individual motors look like?


Hi there!

It seem that you don't have much experience in this kind of thing. So the best choice might be what nehalda explained, but I guess that what matter most in your competition is precision, so i think that there might be around 4 kinds of robots in your competition:

1. Robots that simply vary voltage.
2. Robots that move by encoder (much more precise)
3. Robots that move by encoder and apply PID regarding their position in time (even more precise)
4. Robots that move by giroscope/accelerometer and apply PID regarding their position in time (unnecessarily extremely precise)


4. Robots that move by giroscope/accelerometer and apply PID regarding their position in time (unnecessarily extremely precise)
Lol, I'm doing that. I'll be sure to unnecessarily extremely precisely hang up my medal :P There's nothing wrong with challenging yourself to use things you haven't learned before/seem complex i.e. PID, gyro. I did it mostly on my own with my brother's help and it's going pretty well so far.

Go Up