Pages: [1]   Go Down
Author Topic: arduino laser projector project - rpm meter prob  (Read 1106 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 25
I Love YaBB 2!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello

I am trying to build an arduino laser projector.

at first it will be with 1 mirror , rotating , and rpm meter (optical) using interrupt 0 , and laser powered by uln2003

code , debug info , pics are here -

http://tomsofer.googlepages.com/home2



but my code (based on something I downloaded from arduino site) gives me strange rpm's!

can you help?



thanks

tomas

« Last Edit: January 01, 2008, 02:15:46 pm by tomas » Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello tomas, nice project.

Try removing the serial output from the interrupt handler. You could create an array to hold your data (just a second or so, say 100 elements),store the data in the handler and send them from your loop when your array gets full. Don't forget to disable interrupts when you read and send the data and enable them when you are done. If this solves your problem then you can design some code to makes sure that the interrupt handler and serial print routines don't interfere with each other.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 25
I Love YaBB 2!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I created the debug lines in the interrupt handler to debug the error...

it's still there when I remove those lines...

I will try to delete all serial print code and see what happens.

tomas
« Last Edit: January 02, 2008, 06:24:47 am by tomas » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi there, great project - I plan to try something similar myself when I've finished my current project.

I would try to slim down the interrupt handler as far as possible and move debugging code into your main loop.  Also, from your photos it looks like the arm (cardboard?) cutting the phototransistor may not be balanced - it will interact / drag when it nears the rpm counter aperture.  I would recommend trying a circular disc with one or two small holes cut into it, and triggering your interupt on a rising signal from your phototransistor - this should be more stable.

Also, is there a chance that the interrupt is double-triggering? I don't know enough yet about how the ATMega processor works (I'm an Arduino newbie) but you could try disabling interrups at the start of your handler then re-enabling after logging your timecode, and possibly using a 'debounce' type circuit on the output from your phototransistor to ensure it gives a clean logic signal.

Just ideas, but hope they help.  Let us know how you get on.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 25
I Love YaBB 2!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


1. will try using a circular disc with a small slit (maybe the cardboard arm is really too wide)

2. will try connecting the transistor to ocsilloscope to see what it looks like.
maybe upload the image

3. as you can see on the link from my page , the 15-year-old kids who did this with an atmega8 (not arduino) used a similiar sensor and arm , so there should be litle difference.

Logged

Pages: [1]   Go Up
Jump to: