I race 1/24 scale slot car drag cars, what I am trying to do is build something that controls the motors speed when trigger is pulled.
say when the green light goes i pull the trigger supplying the arduino with about 15.5v, and its start the code right away to start the motor soft so tires dont spin and then slowly ramp up motor speed over time.
the cars are very simple. the guide has two contacts that touches the tracks positive and negative. those contacts go to the motor positive and negative.
but can a arduino start up and run code instantly or is there a delay or boot up sequance.
i have an arduino nano but have never played with arduino before
Are you planning to power the Arduino board with voltage from the track rails? Also, consider the extra weight added to your car from components like the receiver. Or, are you going to WiFi or Bluetooth commands to the car from your iphone?
Arduinos start up instantly. But you don't need it to "start up", just to enable the motor driver upon command (button push).
You should first experiment with toy motors, using a simple setup like this, and learn how to control the speed. You may not even need a motor driver if the action is in one direction only.
As in the linked tutorial, a suitable logic level MOSFET and a couple of additional parts is all you need for that.
ItsCaseyDambit:
Are you planning to power the Arduino board with voltage from the track rails? Also, consider the extra weight added to your car from components like the receiver. Or, are you going to WiFi or Bluetooth commands to the car from your iphone?
Interesting idea.
power arduino from track power.
is there any way the arduino stores the code standalone, so that when its powered on it outputs that code instantly.
so on, motor duty cycle 30%, ramp 5%/.1 second .
Once the Arduino is programmed, it does not forget the program, unless erased and reprogrammed.
If you are planning to use Arduino, start with the simple examples that come with the program development software, and learn how it works. Otherwise you will be very frustrated.
jremington:
Once the Arduino is programmed, it does not forget the program, unless erased and reprogrammed.
If you are planning to use Arduino, start with the simple examples that come with the program development software, and learn how it works. Otherwise you will be very frustrated.
Back when I was a kid, slot car triggers were variable resistors; a small squeeze resulted in slow speed and a full squeeze ran the AFX cars off the track and into the kitchen.
Can you not control the trigger/acceleration yourself or is the switch just binary (on/off)?
You don't need an H-driver if you don't need to reverse the motor. And, you'll get a little more voltage-loss with an H-bridge. (There will be some voltage loss across the MOSFET too, depending on it's on-resistance, but it shouldn't be significant.)
You can read a potentiometer or the DC voltage from a speed controller. If you're reading the nominal voltage from a speed controller you'll need a voltage divider (2 resistors) to knock the voltage down to 5V or less.
Then, you can use the [u]map()[/u] the 10-bit (0-1023) Analog input to the 8-bit (0-256) PWM output.
Then you can add a little time-delay to ramp-up PWM. That's not "hard" but you'll have to use millis() instead of delay() which might be slightly tricky for a beginner.
Or for drag racing you can just use a pushbutton switch.
If you think about it and work on it a little at a time, you should be able to figure-out how to ramp-up slowly (slightly slowly) but ramp-down immediately (not important for drag racing but you want to break more-quickly on a road circuit).
Blackfin:
Back when I was a kid, slot car triggers were variable resistors; a small squeeze resulted in slow speed and a full squeeze ran the AFX cars off the track and into the kitchen.
Can you not control the trigger/acceleration yourself or is the switch just binary (on/off)?
you can but its not very constant in drag racing where you wanna run the same time over and over
You don't need an H-driver if you don't need to reverse the motor. And, you'll get a little more voltage-loss with an H-bridge. (There will be some voltage loss across the MOSFET too, depending on it's on-resistance, but it shouldn't be significant.)
You can read a potentiometer or the DC voltage from a speed controller. If you're reading the nominal voltage from a speed controller you'll need a voltage divider (2 resistors) to knock the voltage down to 5V or less.
Then, you can use the [u]map()[/u] the 10-bit (0-1023) Analog input to the 8-bit (0-256) PWM output.
Then you can add a little time-delay to ramp-up PWM. That's not "hard" but you'll have to use millis() instead of delay() which might be slightly tricky for a beginner.
Or for drag racing you can just use a pushbutton switch.
If you think about it and work on it a little at a time, you should be able to figure-out how to ramp-up slowly (slightly slowly) but ramp-down immediately (not important for drag racing but you want to break more-quickly on a road circuit).
thank you so much for the help. i ordered up a mosfet driver, once i get that in ill try and code the best i can, if i have any questions ill shoot you a pm
HYPERformance:
coding would need to be
on start power motor a certain % and then ramp up over set time
Yes, what model Arduino are you using.
You would have the Arduino powered up all the time and use the trigger to signal the Arduino to start and ramp up the motor controller.
You can have an extra control on the Arduino to set acceleration rate and if you like maximum power to the motor.
I am not sure if you have traction problems with slot car dragsters, but even programming an acceleration ramp to change as you increase speed could help.
As you get to play with the Arduino, you will see many other control possibilities you could do?
void setup() {
motor.rampPercent(30, 300); // Launch control
// Use motor.setSpeedPercent(10) "hits power instantly 10%"
// Use motor.rampPercent(30, 300) "ramps up to 0-30% in .3 seconds"
}
void loop() {
motor.update();
if(motor.onTargetSpeed()) {
// code only runs once per event
Serial.println("Target Speed");
delay(050); // Time between launch control and power adder
motor.rampPercent(100, 500); // Power after launch to finish
// use motor.setSpeedPercent(100) "hits power instantly"
// use motor.rampPercent(100, 300) "ramps up to 100% in .3 seconds"
}
}
Please read the post at the start of any forum , entitled "How to use this Forum".
OR http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
What motor controller have you got?
What model Arduino are you using?
Have you tried your code?