Let's Make Robots!

ADC and PWM

Hi guys,

I've finally found time to test te ADC and PWM capabillities of my picaxe microcontroller :)

Sorry for my bad english, but I'm a little bit tired ;)

 

EDIT:

added an SRF05 ultrasound sensor for some cool FX ;)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I would go with a linear pot as they are easier to work with.

LEDs are a little different than normal diodes...different colors could have different forward voltages. I think blue leds tend to be higher while red are lower.

The issue of the LED going on, I'm not sure of. Have you checked the values that your setting for the pwm. This might be useful to do with the serout command.

For the lowest value do you turn off the pwm output?

pwmout portpin, 0, 0  or off in place of the 0, 0

 

I know that lineair pots are quite a lot easier, but this was just a (or better, the only) pot I had lying around...

Add some debug statements to your code and see what the adc reading is at the high and low point. This should give you a clue as to why the change in light intensity occurs.

Not that this relates to anything at the moment but Also think about the led forward voltage. I think for the ones most of us use it's 1.6 but you can check that with a multimeter if it has a diode tester. This would be something to consider if you want the leds to start coming on when you start turning the dial. Of course you still have to figure out why they don't go out completely at the moment. :)

check your setup as well, I think a resistor to ground from the adc to ground come into play on this circuit.

 

Hove already done the debugging part, as I said: mainly it's because I use an exponential potentiometer. Als the forward minnimumvoltage to make a LED light is in most cases 0.7V (standard diode).

Another weird thing is that my LED's go on when I lower the duty cycle instead of increasing it, or is this normal?

If I find the time tomorrow, I'll draw a schematic of the circuit I built, that way you can check if it's correct ;)

Thanks for the help!

When  lower PWM causes the LED to become brighter, I would suspect that your circuit is inverted. Are you sinking current into the picaxe instead of sourcing current from the picaxe to the LED? It all depends on how you hooked it up. Post a circuit diagram.

You're right, my LED's were connected the wrong way, thanks

Ok, I've found out that I'm using an exponentionally increasing potentiometer, that's why the LED's go from nothing to everything in such a small pot increasement