Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Distance to Motor Powered Music Box

Status
Not open for further replies.

Combover

New Member
Hello all,

I am connecting an IR range finder to an Arduino and then to a motor to turn a music box. The music box is one of the small ones that pulls a sheet of music through controlled by your hand rotating a lever.**broken link removed**

I have made the arduino code by adapting **broken link removed** to suite. I have included my version bellow.

I now need to find a motor that will power the music box and this is where I could do with some help. What voltage of motor (or any specific type) will I need to turn the music box?
And do you think I might have to change anything in the schematic other than the power supply?

I am a big time beginner and could do with the help, thanks..



Arduino Code//
int IRpin = 0; // analog pin for reading the IR sensor
int transistorPin = 9; // connected from digital pin 9 to the base of the transistor
int IRValue = 0;

void setup() {
Serial.begin(9600); // start the serial port
}
void loop() {
float volts = analogRead(IRpin)*0.0048828125; // value from sensor * (5/1024) - if running 3.3.volts then change 5 to 3.3
float distance = 65*pow(volts, -1.10); // worked out from graph 65 = theretical distance / (1/Volts)S - luckylarry.co.uk
analogWrite(9, distance);
Serial.println(distance); // print the distance
delay(100); // arbitary wait time.
}
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top