Replace 6v DC-motor with a 12v DC-motor ?

Hi!

I'm looking for some help / guidance with this part of my project.
I have wired up this and managed to make it work:

But now I would like to replace that ^^ DC-motor with this one:

I need the motor to behave in the same way. Go from 0 rpm to full speed (32rpm).
I would really appreciate some help with what modifications I should make in the code and also what I need to change on the breadboard.

/All the best, Rob

The RPM would of course depend on the motor you wanna use in the new version of your project.

But apart from that, you need to figure out how you'd like to power your motors. You will need a 12v power supply. 6V wouldn't be enough any more.

Deepening on what 12V DC motor you choose, you need to check its rated current draw at full speed, and based on that decide how you'd like to drive your motor e.g. using a motor driver or you're own design.

The code would be almost identical except that you might do some adjustments on the speed of your new motor.

Good luck!

You'll need a motor power supply that can provide enough current at the relevant voltage. That motor
can pull 5A stall current which is just within the TIP120's limit fortunately, so everything else should
work with it.

MarkT:
You'll need a motor power supply that can provide enough current at the relevant voltage. That motor
can pull 5A stall current which is just within the TIP120's limit fortunately, so everything else should
work with it.

Allright! Thank you. I have a 12v battery with this information on it:


12v 1.3Ah /20hr

Cycle use: 14.40 - 15.00 V

Standby use: 13.50 - 13.80 V

Initial current: less than 0.39A


But I'm a little afraid of wire up the battery. I don't want to destroy my Arduino :slight_smile: But is my fear justified?

The battery is for the motor, not the Arduino, I hope... Its never good to share power
between motors and electronics, motors can put a lot of spikes and drop-outs on their
supplies.

The Arduino power jack and Vin will run from upto about 12V, but the onboard regulator
can get quite hot that way. I'd suggest using a separate 5V regulator (such as a 7805
on a heatsink, or a cheap switchmode one like this: http://www.ebay.co.uk/itm/LM2596-DC-DC-Switching-Adjustable-Step-Down-Voltage-Regulator-Buck-Converter-/271632729700?hash=item3f3e928664).

The switchmode means you can either feed a clean 7V or so into the power jack, or 5.0V direct into
the 5V pin, and it will work from a wide range of voltages.

Alternatively use USB power for the Arduino.

MarkT:
The battery is for the motor, not the Arduino, I hope... Its never good to share power
between motors and electronics, motors can put a lot of spikes and drop-outs on their
supplies.

The Arduino power jack and Vin will run from upto about 12V, but the onboard regulator
can get quite hot that way. I'd suggest using a separate 5V regulator (such as a 7805
on a heatsink, or a cheap switchmode one like this: http://www.ebay.co.uk/itm/LM2596-DC-DC-Switching-Adjustable-Step-Down-Voltage-Regulator-Buck-Converter-/271632729700?hash=item3f3e928664).

The switchmode means you can either feed a clean 7V or so into the power jack, or 5.0V direct into
the 5V pin, and it will work from a wide range of voltages.

Alternatively use USB power for the Arduino.

I have now wired up the 12v battery (I think I have done it correctly). But the speed of the motor is not changing when I use the potentiometer. It seems to just turn the motor on or off...
Is there anything in the code I should change to adapt it to the new motor?

int analogInPin = A0;

int sensorValue = 0;

int outputValue = 0;

int transistorPin = 3;

void setup()

{

Serial.begin(9600);

pinMode(8, OUTPUT);

pinMode(9, OUTPUT);

pinMode(transistorPin, OUTPUT);

}

void loop()

{

sensorValue = analogRead(analogInPin)/4;

outputValue = map(sensorValue, 0, 1023, 0, 255);

analogWrite(transistorPin, sensorValue);

if (sensorValue >= 160)

{

//example

digitalWrite(8, HIGH);

digitalWrite(9, LOW);

}

else

{ digitalWrite(9, HIGH);

digitalWrite(8, LOW);

}

delay(10); }

Read your code carefully:

sensorValue = analogRead(analogInPin)/4;

outputValue = map(sensorValue, 0, 1023, 0, 255);

analogWrite(transistorPin, sensorValue);

The 10 bit to 8 bit conversion is done twice, but you ignore outputValue anyway!

Despite that it ought to work, I'd suggest debugging methodically - take a multimeter and
check that the input voltage from the pot is what you think it is, and add print statements
to check the output value is also what you think it should be. If so then the problem
is in the TIP120 circuit perhaps?

MarkT:
Read your code carefully:

sensorValue = analogRead(analogInPin)/4;

outputValue = map(sensorValue, 0, 1023, 0, 255);

analogWrite(transistorPin, sensorValue);



The 10 bit to 8 bit conversion is done twice, but you ignore outputValue anyway!

Allright! I am really new to all this stuff... So what happens if I change the "0" to something else?
What is the outputValue describing?

Allright! I am really new to all this stuff... So what happens if I change the "0" to something else?

Why not try it? Why not look up the documentation of map?

What is the outputValue describing?

The value to be output perhaps? Its your code isnt it? Well I guess you adapted it - start learning
how to debug (for instance put print statements everywhere so you can see what actually happens)