readADC issue

noise0

Member
According to attached image

I put HIGH OUT
then I read ADC from input

I read always 0 (zero)

It's very strange beacuse i have tested OUT value and it's near to VCC
If i replace OUT directly with VCC , ADC reading works fine

can anyone help me?
________
Yamaha venture
 

Attachments

Last edited:

ylp88

Senior Member
What are your resistance values? If they are too low, your output pin might have trouble sourcing sufficient current.

ylp88
 

hippy

Technical Support
Staff member
Definitely something strange there, it should work. You could try measuring the voltage at OUT and at ADC IN, when connected to VCC and when driven by HIGH.

You are not tying to READADC on the same pin you are controlling as OUT are you ?
 

noise0

Member
upper resistor is a LDR
lower resistor is a 4k7

i am using picaxe 18X

about pin numbers and voltage readings , i will be back here to report this evening
________
Head shop
 
Last edited:

superworm

New Member
Really sounds like you aren't getting enough current to the ADC pin, they need a certain amount to function. Sounds like your LDR is too resistive for the low current output of the PICAXE output pin.

Attatch an NPN transistor, any will do say a BC548, in this fashion...


Output pin...to BASE of transistor through a 1K resistor

Direct Circuit Source Voltage to COLLECTOR of transistor

EMITTER of transistor to the start of your LDR/Resistor setup to supply the ADC pin. Be careful not to put too much current into the ADC pin.

That's how I would do it anyway....you could also replace the above mentioned transistor with a small relay using a BC517 darlington transistor, and a protective diode.

Have a try and experiment....it's what PICAXE is all about!
 

noise0

Member
i have already tested the NPN solution and it works fine....
but consider that this is a very thin, lo-voltage, solarized application
so i prefer to use the simplest possibile setup in order to reduce size and power drain.

anyway, in the worst case the ldr+resistor measure 5 Kohm
the voltage is 3v
so the required curresnt is 0,6 mA
it sound strange to me that a piacaxe output can not source 0,6mA...

anyway this evening i will got to doublecheck voltages and pin nubers so we will see
________
YAMAHA SR250
 
Last edited:

ylp88

Senior Member
it sound strange to me that a piacaxe output can not source 0,6mA...
The chip should be able to source 20mA without too many problems. Certainly you should not need to use a transistor to do what you want to do and I think it's best to follow the KISS principle.

Try running the chip on 5V and see what happens...

ylp88
 

superworm

New Member
Unfortunately you did not specify what the max resistance of the LDR was so I could only assume it was above the recommended limit of 20K.

I agree with ylp88, try 5V, if that does not work, consider the fact that adding one small transistor is a very easy fix and most of us wish that our tech problems could be fixed so easily haha!
 

noise0

Member
reporting in...
i have checked connections and pin numbers and now..... it seem to works fine :|

probably i was too stoned last night :)

please excuse me for the fault ..........
________
Portable Vaporizer Reviews
 
Last edited:
Top