Electronics > Beginners
Arduino PWM signal acquisition dubt
Lucky-Luka:
I'm doing a little project in order to learn to use Arduino.
In the attached image it's shown the circuit.
3 phototransistors with 3 colored filters let a RGB LED shine accordingly to che color of the light that hit the three sensors.
I have connected my probes to the pins 11 (RED), 10 (BLUE) and 9 (GREEN).
Those are the 3 traces displayed on the oscilloscope screen. I change light conditions sequentially (RED light then GREEN light then BLUE light) and I can see that the duty cycle of the 3 signals (RED, GREEN, BLUE) change accordingly.
The red trace (PIN 11) is the one the trigger of the scope is referred to.
Its rising edge is fixed on the screen while its falling edge moves accordingly to the power supplied by the probed PIN.
When the power delivered to the PIN 10 and 9 changes looking at the GREEN and BLUE traces I notice that not only the corresponding falling edge move on the screen but even the rising edges move.
In another moment I have set the trigger for the GREEN trace: in this case only the GREE trace rising edge is fixed.
I have even set the trigger for the BLUE trace and I have noticed that only the BLUE trace rising edge is fixed.
Can sonmeone tell me what's going on?
I was expecting to see all the three rising edges traces in fixed positions on the screen.
I have to say that I'm still learning to use the scope so maybe I haven't understood something related to its settings.
Cheers
https://youtu.be/4YkDUCK050s
MasterT:
Pins 9 & 10 belong to Timer-1, and pin 11 to Timer-2. Two timers are not synchronized, so phase offset could be anything.
Lusu:
More over, Timer 2 is 16 bits while Timer 1 is 8 bits...
You need to trigger independently each channel, or probe pin 11 individually.
Lucky-Luka:
Very interesting.
I think I need to read the ATmega328P datasheet.
It looks like that behind the curtain nothing is so straightforward as what the Arduino high level language induced me to think.
Lucky-Luka:
In the attached pic it's shown what happens when the blue signal is triggered and I use blue light.
The duty cycle of the blue trace increases while both the green and red traces just shift to the right.
If pin 9 (GREEN) and pin 10 (BLUE) refer to the same timer shouldn't those traces have the same position for the rising edges?
Cheers
Navigation
[0] Message Index
[#] Next page
Go to full version