Need Help with IR Sensor Speed Control for Large DC Motor


hello all,

i'm having issues speed sensor subsystem shaker i'm building.  i'm using 180vdc motor move shelf between 60 , 240 rpm.  @ end of shelf have ir emitter , photo-transistor interrupted metal plate attached shelf.  now, code counts number of times sensor interrupted, few calculations display rpm. 

when motor turned off, , sensors turned on; able interrupt senors notecard , count works immaculately. however, when motor turned on (regardless of speed), unable display on serial monitor.

the following code i'm implementing on arduino
code: [select]

#include <avr/interrupt.h>

float motor_speed = 0; //speed control, range 0 - 255, 255 being fastest speed

void setup()
{
  serial.begin(9600);
  pinmode(9,output); //pwm output speed control
  pinmode(2,input); //ir sensor input
  digitalwrite(2,high); //assign pull-up resistor pwm output
  analogwrite(9,255-motor_speed); //write speed motor
  attachinterrupt(0, speed_calc, rising); //activate interrupt
}

void loop()
{
}

void speed_calc()
{
static int count = 0; //count number of times sensors interrupted
serial.println(count);
count++;
}


the following specs of related equipment problem

micro:
arduino mega

motor:
180vdc
1/2hp
2.25a

speed control:
http://www.kbelectronics.com/manuals/kbwd_13_16_manual.pdf

speed sensors:
http://www.radioshack.com/product/index.jsp?productid=2049723
(i've attached image of how speed sensors set without enclosure)

any or input has appreciated, thank you!

why code display anything?  going run loop nothing in it, never calling speed_calc() function.

looks working written me.


Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > Need Help with IR Sensor Speed Control for Large DC Motor


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support