Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years ago.
Light Gate program for a science fair project
So I was wondering if some kind soul could help me out. I have a science fair project in which i prove lenz's theory of opposite magnetic fields. To measure this, I will be taking the time it takes for certain blocks to fall through a copper tube. To get these measurements i have installed two light gates, one above the pipe and one underneath it. I would like to send the results back to my mbed processor so that it can accuratly tell me how many milliseconds it took said object to fall through the tube. I would then like the results to be displayed on the computer screen so that i can list them in an excel document and thus compare them. Thank-you in advance for any help or suggestions that i get.
4 Answers
11 years ago.
First of all, before you pull any remaining Hair out:
1, does your sensor work?? 2, does your MBED recognizes pulses from sensor? if not tell us what it is so someone can help further,
Code to test sensor:
DigitalIn StartOpto (p20); while (1) LED = (StatlrtOpto)
So ..
If you look through cookbook, you will find:
Attach ISR to Pin Rise/Fall, Timer Start/Stop, and some simple printf stuff,
now attach ISR event Start OPTO -> Start Timer, attach ISR event Stop OPTO -> Stop Timer, set flag, done,
in main: if done flag,
if (done) printf ("It took %3.3f mS to pass between sensors\r\n", Read.Timer()); Done = false; }
on a liter note, if you are using a copper tube, Drop a NdFeBo Rare earth magnet down the tube !!!!
and watch the crowds jaw's drop
:) Ceri
11 years ago.
It might be worth figuring out exactly what that voltage is and making sure it is high enough. See Ceri's code above to test the sensor.
The voltage is around 1v when the sensor is not triggered but rises to 5v when the sensor is tripped.
posted by 04 Dec 2013The lowest voltage to reliably generate a logic low is about 1V. Use a diode and a 1kohm resistor in series to ground. Tap the output from the diode to connect to the input pin on the mbed.
posted by 04 Dec 201311 years ago.
What is exactly your question? Where are you stuck?
With your description I would guess it is simply connectnig the light gate to your mbed, start a timer when the first one is passed, stop it when the second one is passed. Divide by the distance, print it to your serial console.
11 years ago.
that is exactly what i am trying to do however i have been unsuccesful at doing so
We really need more information in order to help: 'It doesn't work" isn't something we can do much with. What does work and what doesn't.
posted by 29 Nov 2013So i have compiled my program without a problem and downloaded it and saved on to my mbed processor, however upon trying to run the program i get no response what so ever. I have have used two pin ins for the light gates to send their signals to to start and stop the timer. I would then like the time to be outputed to the computer but have no idea how to do so. I have downloaded HyperTerminal as recommended by mbed but have no idea how to use it or to code in order to use it.
posted by 30 Nov 2013If you don't know how to send something to your computer and you don't know how to receive something on your computer it isn't strange you aren't getting a response. Do it step by step.
First of all by mbed it is more recommended to use TeraTerm, alot easier in usage. Then have a look at: http://mbed.org/handbook/SerialPC, and get basic communication to work first.
posted by 30 Nov 2013Thank-you for your help. i have downloaded TeraTerm and have done the practices as suggested. Everything has worked excellently. However, when it comes to the timer i am having problems getting the timer to start when the signal comes in from the light gates (the signal to start is voltage high).
posted by 30 Nov 2013