Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PWM Off Polarity #15

Open
georgev93 opened this issue Apr 2, 2023 · 6 comments
Open

PWM Off Polarity #15

georgev93 opened this issue Apr 2, 2023 · 6 comments

Comments

@georgev93
Copy link
Contributor

When the PWM is off (not modulating), the pin is left in the high state. This will increase your current draw by >400%, since you'll be leaving the LED on most of the time.

I remember wrestling with this in the early days of this project, then I stopped wrestling when the simulator predicted the pin would stay low.

I see in the MCC that the PWM is set to "active_lo". Maybe changing that to active_hi would fix it? That certainly seems to invert things in the logic analyzer. Also, it would make sense to set it to active_hi. I would think that would mean that when PWM is off, it would be low (only high when it's active).

@emailing-files-is-still-better
Copy link
Owner

So I put shrimp on the actual unit last night and it looks like signals are coming in active low. So looks like that might be why we had that in the first place? To match the signals I was seeing.

@georgev93
Copy link
Contributor Author

That sounds like us. So are you seeing the correct behavior when it is set to active_lo or active_hi? Also, where exactly are you probing? The board I soldered wires on to breaks out the output of the microcontroller going to the NFET transistor. However, if you probe at the LED pins (after the NFET transistor), the logic will be inverted. So to sum up:

  • Wires on that microcontroller-only board: not-inverted logic
  • LED+ pin: Always high
  • LED- pin: inverted logic from what the microcontroller spits out

@emailing-files-is-still-better
Copy link
Owner

I'm probing on your dev board. So then Active High would actually be active low?

@georgev93
Copy link
Contributor Author

Screenshot_20230409-131726_GitHub.jpg

Anywhere you probe in blue will be the logic that the microcontroller is outputting (high is LED on, low is LED off). Anywhere you probe in yellow will be inverted from the output of the microcontroller (low is LED on, high is LED off)

@emailing-files-is-still-better
Copy link
Owner

So when using your dev board, and making the output look like what I am seeing when I probe the receiver It all works. Maybe because the decoding photo transistor flips the signals as well. Either way the current configuration is working to transmit to the receiver from my fully soldered up board.

@georgev93
Copy link
Contributor Author

It's hard to say if the logic is flipped on your phototransistor. You could always see what the shrimp says if you hook up your phototransistor and have no IR LED present. That way, if it shows high for instance, and your phototransistor probe is high most of the time when actually observing the blinky board, then we should be good. Or you could do the 'ol phone camera trick and see if it's on most of the time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants