Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Sensors / Re: Sensor that gives PWM reading in pulse train on: October 28, 2013, 12:42:56 pm
It's from a sensor which measures 3 different properties calculated this way:

Code:
Measure1 = ((pwm[0]%-32)/3)*10
Measure2 = (((pwm[1]%-20)/(pwm[2]%-20))*0.7)*120
Measure3 = (pwm[2]%-8)/12

Pulse chain is given as the diagram posted says. So, I think that, if the values are given %, it talks about duty cycle.
2  Using Arduino / Sensors / Re: Sensor that gives PWM reading in pulse train on: October 28, 2013, 07:43:50 am
I don't know if those datas are correct, but let's assume they are ok.
So basically, if I understand correctly, the values I get are the duty cycle?
3  Using Arduino / Sensors / Re: Sensor that gives PWM reading in pulse train on: October 28, 2013, 06:31:01 am
Mmm.... changing to that values gives me:

Code:
PWM 0=39
PWM 1=38
PWM 2=20
4  Using Arduino / Sensors / Re: Sensor that gives PWM reading in pulse train on: October 28, 2013, 06:07:29 am
Ah, it went away to me too!
Corrected, but I still get the same:

Code:
PWM 0=0
PWM 1=0
PWM 2=0
5  Using Arduino / Sensors / Re: Sensor that gives PWM reading in pulse train on: October 28, 2013, 05:50:45 am
...and I get 0 again:

Code:

PWM 0=0
PWM 1=0
PWM 2=0
PWM 0=0
PWM 1=0
PWM 2=0
PWM 0=0
PWM 1=0
PWM 2=0
PWM 0=0
PWM 1=0
PWM 2=0
PWM 0=0
PWM 1=0
PWM 2=0
PWM 0=0
PWM 1=0
PWM 2=0
PWM 0=0
PWM 1=0
PWM 2=0
PWM 0=0
PWM 1=0
PWM 2=0
PWM 0=0
PWM 1=0
PWM 2=0
PWM 0=0
PWM 1=0
PWM 2=0

6  Using Arduino / Sensors / Re: Sensor that gives PWM reading in pulse train on: October 28, 2013, 05:21:42 am
Nice, this is what I get:

Code:

Lettura 0=45196
Lettura 1=44724
Lettura 2=23212
Lettura 0=45196
Lettura 1=44584
Lettura 2=23232
Lettura 0=45196
Lettura 1=44748
Lettura 2=23208
Lettura 0=45200
Lettura 1=44584
Lettura 2=23212
Lettura 0=45200
Lettura 1=44724
Lettura 2=23232

Good! We get results. Now I need to calculate PWM1, PWM2 and PWM3. That is simply done by this:

PWM1 = T1 / T
PWM2 = T2 /T
PWM3 = T3/T

That way we designed PWM signal definition. Then, T1 is the total time subtracted the time that signal stays LOW. Am I correct? I think this is already done in the code. Right?
7  Using Arduino / Sensors / Re: Sensor that gives PWM reading in pulse train on: October 28, 2013, 04:42:06 am
Done, but i get this:

Code:

Lettura 0=0
Lettura 1=0
Lettura 2=0
Lettura 0=0
Lettura 1=0
Lettura 2=0
Lettura 0=0
Lettura 1=0
Lettura 2=0
Lettura 0=0
Lettura 1=0
Lettura 2=0
Lettura 0=0
Lettura 1=0
Lettura 2=0
Lettura 0=0
Lettura 1=0
Lettura 2=0
Lettura 0=0
Lettura 1=0
Lettura 2=0
Lettura 0=0
Lettura 1=0
Lettura 2=0
Lettura 0=0
Lettura 1=0
Lettura 2=0
Lettura 0=0
Lettura 1=0
Lettura 2=0
Lettura 0=0
Lettura 1=0
Lettura 2=0
8  Using Arduino / Sensors / Re: Sensor that gives PWM reading in pulse train on: October 28, 2013, 04:22:04 am
That's what I get:

Code:
Low=44724 High=71020
Low=43992 High=71156
Low=22616 High=1249748
Low=44004 High=71020
Low=43992 High=71156
Low=22628 High=1249764
Low=44000 High=71020
Low=44000 High=71164
Low=22624 High=1249824
Low=44004 High=71012
Low=43992 High=71156
Low=22620 High=1249804
Low=44004 High=71024
Low=43992 High=71156
Low=22776 High=1249636
Low=44004 High=71020
Low=44136 High=71016
Low=22624 High=1249764
Low=44004 High=71024
Low=43996 High=71156
Low=22624 High=1249780
Low=43996 High=71016
Low=43992 High=71156
Low=22640 High=1249764
Low=44000 High=71020
Low=44124 High=71020
Low=22636 High=1249740
Low=43996 High=71016
Low=43984 High=71160
Low=22640 High=1249744
Low=44004 High=71012
Low=43992 High=71156
Low=22624 High=1249784
Low=44004 High=71016
Low=43992 High=71160
Low=22784 High=1249652
Low=43996 High=71020
Low=43992 High=71156
Low=22796
9  Using Arduino / Sensors / Re: Sensor that gives PWM reading in pulse train on: October 28, 2013, 03:28:49 am
If you take a look on the first line just below "PAUSA" in the diagram, you will see that it says

1 sec + 200 msec

oh wait - 1 sec + 200 msec maybe it's not 1.2 secs?
10  Using Arduino / Sensors / Re: Sensor that gives PWM reading in pulse train on: October 28, 2013, 03:09:09 am
Looks like no input is being received. The code I suggested assumes that you are running on an Arduino Uno and you feed the input to digital pin 2 (because that is the pin that triggers interrupt 0). Is that what you have done? Do you have a common ground between the sensor and the Arduino?

Sure yes! Output from the sensor goes to Arduino digital pin 2 and there is ground in common. Maybe there's something with timing in the code? I don't think...
11  Using Arduino / Sensors / Re: Sensor that gives PWM reading in pulse train on: October 26, 2013, 07:02:49 am
dc42, thanks for the reply.

Using that code i get these results from the serial monitor:

Code:

PWM 0=0
PWM 1=0
PWM 2=0


what's wrong?
12  Using Arduino / Sensors / Re: Sensor that gives PWM reading in pulse train on: October 26, 2013, 03:03:41 am
Thanx dc42, that's a nice idea.
If I'm not doing something wrong... and if I understood correctly, 100% duty cycle (in this case LOW signal) should be 1.200 milliseconds.
If I have to do the following calculation I need:

Code:
PWM1 = T1/T
PWM2 = T2/T
PWM3 = T3/T

should be
Code:
PWM1 = lettura[0] / T (T, taking a look at the wave graph above, should be 1.200 milliseconds, is that correct?)
PWM2 = lettura[1]
PWM3 = lettura[2]

What do you think?
13  Using Arduino / Sensors / Sensor that gives PWM reading in pulse train on: October 25, 2013, 12:12:21 pm
Hi every1!

I'm having a problem, already posted in Italian section, but I'm posting here so maybe the solution can be helpful to people around there.
I have a sensor which makes 3 readings in a pulse train (inverted PWM signal). Here's an image that maybe explains better:



As you can see, it is inverted PWM output. That's why I need to take the time of the LOW signal states.
Then, I need to calculate the three different values with this simple formulas:

PWM1 = T1/T
PWM2 = T2/T
PWM3 = T3/T

the period of T should be 1.2 sec = 1200 milliseconds.

I would like to do this with pulseIn() or interrupt, but maybe pulseIn() is much more easier. I don't have any idea on how to do this. Any ideas? Thanks!
14  International / Software / Re: Leggere da sensore PWM on: October 25, 2013, 10:04:49 am
E aggiungo: essendo che dovrei calcolare PWM1 = T1/T, da quando appare in quello schema, dovrebbe essere il tempo in cui il segnale rimane in LOW / 1.200 millisecondi... giusto?
15  International / Software / Re: Leggere da sensore PWM on: October 25, 2013, 06:05:33 am
Paolo, ti ringrazio molto. Solo che

"Altrimenti sposti l'acquisizione dentro l'interrupt insieme all'indice e all'array."

non riesco a capirlo, nel senso che non mi è chiaro "spostare l'acquisizione dentro l'interrupt". Non è già così?
Pages: [1] 2 3 4