Go Down

Topic: Ardunio sensing questions (Read 852 times) previous topic - next topic

xrc11

I'm in the middle of a school project and am running into some issues. I'm trying to use an Arduino to sense the voltage spike from a Hall Effect sensor that is in close contact with a spinning "pick up" wheel that we had cut out from a water jet table. The pickup wheel goes onto a spinning shaft extruding from the differential of our buggy. Over the weekend we took the sensor into the lab and simulated our spinning wheel and used an oscilloscope to look at the signal and a multi-meter to test max voltage generated. The max voltage we got was .33 DCV. We found a code online for Arduino that hopefully I can post below and simply had us put one wire from the sensor into an analog input on the uno and the other wire from the sensor to ground on the uno. We opened up the serial monitor and watched the program and uno sense voltage.

My questions are, we had no time reference so is there a way to have the time posted beside the voltage value in the serial monitor window? Also, what is the base line sensing time that the uno is set to and how to I change it to the shortest time increments as possible. Thirdly, is there a way to set the uno up to just sense an incoming voltage when a signal is presented to the uno? I would prefer that was so if the buggy becomes stationary for a couple of minutes, the uno is not filling up pages and pages of zeros.

I honestly do not know how to write code so this has been very frustrating. The group is talking about using a raspi in conjunction with the uno but that is down the road. Thanks for the help


knut_ny

Some hall-sensors have a digital output.. (check datasheet for your sensor)
If digital;  connect to an interruput pin  (pin 2 or 3 on an UNO)
Ny

xrc11

#2
Feb 20, 2018, 03:19 pm Last Edit: Feb 20, 2018, 03:39 pm by xrc11
I wish I could find the data sheet for the sensor. It was given to us for free off of some vehicle and the part number off of the sensor is rubbed off unfortunately. Here is a picture of its signal on the scope I don't know if analog or digital. We did get data when it was plugged into a analog port on the Uno

xrc11


knut_ny

#4
Feb 20, 2018, 03:46 pm Last Edit: Feb 20, 2018, 03:47 pm by knut_ny
I'd try to connect it to pin 2.
You can determine if it can be used as a digital sensor.
If you can detect the magnet (read both 0 and 1) -> use it interruptdriven

If all readings are 0, try a 10k pullup resistor (or internal pullup)
Ny

xrc11

Scope...

xrc11

Data from serial monitor window...

I feel like the sensor is working fine. I just need to know how to speed up the sensing time of the arduino or switch it to a completely reactive state

knut_ny

#7
Feb 20, 2018, 07:08 pm Last Edit: Feb 20, 2018, 07:15 pm by knut_ny
Your code:  Your function (analogVal*5) ?
The scope picture; axis voltage ? (where is 0V)
Does the spike vary with speed?
-----------

Is the task to make Arduino recreate the scope picture ? , Measure max spike voltage? or find RPM?
..i'm confused
Ny

xrc11

When we increased the rpms there were more spikes. Depending on how close the magnet of the sensor was to the spinning wheel, the spike would get larger or smaller.

knut_ny

I guess you got this type
Linear (analog)
Needs av extra opamp to be used as a digital sensor.
As is, it is best used with slow moving systems.

..vs one with the Schmitt trigger , like this one

If your goal is RPM_counting, a Scmitt-trigger output is the 'easy' way to go. (you'll get 10 for $)

Ny

xrc11

The arduino is sensing the voltage from the sensor, why would I want to change anything as far as the sensor goes?

xrc11

#11
Feb 22, 2018, 01:17 am Last Edit: Feb 22, 2018, 01:25 am by xrc11
I don't want to get off into the weeds are far as our sensor goes. When testing, we got an analog signal (at least it looks analog on the scope) and when used in one of the Uno's analog inputs, it sensed the voltage. In class our professor told us to find out the maximum number of signals that will be generated by our sensor per second and then adjust the Uno's sensing rate to 10 times that so that it never "misses" a signal. So, is there a way to adjust the Uno's sensing rate to about 800 signals/sec? It says on the arduino webpage that the Uno's maximum reading rate is 10,000 times/sec which is far more than 800.

xrc11

Well, I got some more clarification today at school. Someone had the idea to instead of trying to "change" the sampling time of the Uno, write the code for the Arduino so that it is made to sense voltage at a specified frequency. I was planning on using the AnalogRead function. Should I create a loop with say an if statement or while statement that calls on the AnalogRead function every .00125 seconds? Doing it this way I would have my time intervals already. Any help is appreciated

Go Up