555 frequency/voltage converter for MotorShield

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

555 frequency/voltage converter for MotorShield

Postby shi-nee » Tue May 01, 2012 1:43 pm

I've been trying to read RPM from a motor and then adjust the speed. The only code I can come up with to reliably read RPM off a Hall effect sensor is based on interrupts. I'm trying to find a schematic for a 555 based frequency converter. What I want to end up with is a variable voltage to feed into my Arduino ADC representative of the motor RPM. I've found lot's of F to V converter circuits, I'm wondering if anyone can point out the most Arduino friendly circuit?

RPM code I've been using, which is great for reading RPM. Every time I attempt to switch an output based on the variable 'rpm' I get no activity on 'motorPin'. But if I manually apply voltage to the motor I get a perfect rpm reading. If I digitalWrite motorPin HIGH in loop it will turn on the pin and still give correct rpm.

Code: Select all
   int rpmcount = 0;
   int rpm = 0;
   int timeold = 0;
   int motorPin = 8;
   int ledPin = 13;

void setup()
{
   pinMode(motorPin, OUTPUT);
   pinMode(ledPin, OUTPUT);
//  digitalWrite(motorPin, HIGH);
   digitalWrite(ledPin, HIGH);
   
   Serial.begin(57600);
   attachInterrupt(0, rpm_fun, RISING);
}

void loop()
{
   if (rpmcount >= 20) {
     //Update RPM every 20 counts, increase this for better RPM resolution,
     //decrease for faster update
     rpm = 30*1000/(millis() - timeold)*rpmcount;
     timeold = millis();
     rpmcount = 0;
     Serial.println(rpm,DEC);
     if (rpm < 3400){
     digitalWrite(motorPin, HIGH);
     digitalWrite(ledPin, HIGH);
     } else {
     digitalWrite(motorPin, LOW);
     digitalWrite(ledPin, LOW);
     }
   }
}

void rpm_fun()
{
   rpmcount++;
   //Each rotation, this interrupt function is run twice
}
shi-nee
 
Posts: 5
Joined: Tue May 01, 2012 1:28 pm

Re: 555 frequency/voltage converter for MotorShield

Postby john444 » Sat May 05, 2012 9:17 pm

Hi Shi-Nee,

A LM565 may be a much better choice. It is a phase-locked loop IC. It can be connected so as to produce a dc voltage proportional to the frequency put into it. It is an old IC (inexpensive) and there is a lot of info on it.
It has only about a 10:1 capture range but if that is good enough for your application, you might give it a try.

Good Luck
john444
 
Posts: 418
Joined: Sun Mar 04, 2012 1:42 pm
Location: Claremore, Ok


Return to Arduino Shields from Adafruit

Who is online

Users browsing this forum: No registered users and 6 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [114]

Raspberry Pi[82]
 
FLORA[24]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[12]
Arduino[60]
 
NETduino[14]
 
BeagleBone[23]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[39]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[9]


 
Breakout Boards[35]
LCDs & Displays[49]
Components & Parts[70]
Batteries & Power[54]
EL Wire/Tape/Panel[52]
LEDs[112]
 
Wireless[16]
Cables[66]
 
Lasers[6]
Sensors/Parts[147]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[41]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[25]


 
Stickers[41]
 
Skill badges[55]
 
Books[26]
 
Circuit Playground[7]
 
Gift Certificates[4]