ADC and Safe Mode
ADC and Safe Mode
Hello
I have a problem with the ADC (PinX19-X21, X3-X7 and X11 and X12) and the USB.
At the start I read the "zero" values to calc the difference. When the difference is psoitiv the red led get on and when negatie a green led.
When I use putty to schow the prints it runs very vell, but when I start it with the rest button without USB-Cable ist don't work.
The values of the ADC are greater.
To use Putty I start the pyboart in the Safe mode. http://docs.micropython.org/en/latest/t ... reset.html
Do you have any Idea?
Thank you
I have a problem with the ADC (PinX19-X21, X3-X7 and X11 and X12) and the USB.
At the start I read the "zero" values to calc the difference. When the difference is psoitiv the red led get on and when negatie a green led.
When I use putty to schow the prints it runs very vell, but when I start it with the rest button without USB-Cable ist don't work.
The values of the ADC are greater.
To use Putty I start the pyboart in the Safe mode. http://docs.micropython.org/en/latest/t ... reset.html
Do you have any Idea?
Thank you
Last edited by mschulz on Thu Jun 25, 2015 2:30 pm, edited 1 time in total.
Re: ADC and USB
Do you have a schematic which shows how things are connected?
How are you powering the board when not plugged into USB?
Have you measured the voltage being fed to the adc to verify that its the same?
Is A3V3 the same voltage in both cases?
How are you powering the board when not plugged into USB?
Have you measured the voltage being fed to the adc to verify that its the same?
Is A3V3 the same voltage in both cases?
Re: ADC and USB
Hallo
The following picture schows the Pins I used.
used Pins:
https://www.dropbox.com/s/g476ysd5z0cdh ... e.png?dl=0
Platine Top
https://www.dropbox.com/s/rruqd1zyfdz0q ... p.png?dl=0
Platine Bottom
https://www.dropbox.com/s/8wcuf3uqia047 ... t.png?dl=0
Over the Timer 1 and 8 I controll an RGB LED.
Power:
The board is powered by 24V and a voltage regulator (on the right side). I think there is enough power.
The Sensors I use have an Output between 2,5-5V and get the power from the same source.
To avoid voltage drop the servos have there own voltage regulator (on the left side).
Voltage fed on the ADC: I am so shocked, that I dosn't do something, but I don't know why it should change...
Tomorrow I will check the A3V3 voltage and the ADC input in both cases.
Will make sense to pull up the A3V3 to the same value with I supply the sensors? (of course over the same voltage divider)
Thank you for your helpful questions. So I know what I can check tomorrow .
Edit: Change the URL to the pictures, but there is an error too.
The following picture schows the Pins I used.
used Pins:
https://www.dropbox.com/s/g476ysd5z0cdh ... e.png?dl=0
Platine Top
https://www.dropbox.com/s/rruqd1zyfdz0q ... p.png?dl=0
Platine Bottom
https://www.dropbox.com/s/8wcuf3uqia047 ... t.png?dl=0
Over the Timer 1 and 8 I controll an RGB LED.
Power:
The board is powered by 24V and a voltage regulator (on the right side). I think there is enough power.
The Sensors I use have an Output between 2,5-5V and get the power from the same source.
To avoid voltage drop the servos have there own voltage regulator (on the left side).
Voltage fed on the ADC: I am so shocked, that I dosn't do something, but I don't know why it should change...
Tomorrow I will check the A3V3 voltage and the ADC input in both cases.
Will make sense to pull up the A3V3 to the same value with I supply the sensors? (of course over the same voltage divider)
Thank you for your helpful questions. So I know what I can check tomorrow .
Edit: Change the URL to the pictures, but there is an error too.
Last edited by mschulz on Thu Jun 25, 2015 5:15 pm, edited 3 times in total.
Re: ADC and USB
You mentioned that the sensors output up to 5V. I just wanted to make sure that you're aware of the fact that the ADC inputs need to be limited to 3.3v.
The digital inputs are 5v tolerant. The analog inputs are not.
The digital inputs are 5v tolerant. The analog inputs are not.
Re: ADC and USB
I know. therefore I use a valtage divider.
Today I do not change anything on the hardware or Software. I only start the board on diffferend ways.
First case safe: mode (start with putty [Str. + D)
second case: reset, start with the RST button
The ADC input Voltage is in both cases the same (about 1,7V )
A3V3 voltage is in both cases 3,28 V
The start is in both cases equal. But than in the safe mode it does what it is supposed to, (green LED on) but in the RST modus the red LED is on.
Today I do not change anything on the hardware or Software. I only start the board on diffferend ways.
First case safe: mode (start with putty [Str. + D)
second case: reset, start with the RST button
The ADC input Voltage is in both cases the same (about 1,7V )
A3V3 voltage is in both cases 3,28 V
The start is in both cases equal. But than in the safe mode it does what it is supposed to, (green LED on) but in the RST modus the red LED is on.
Re: ADC and Safe Mode
My experiments show, that I have an offset between the adc in safe mode and normal boot modus.
Have anybody an Idea why? Or where could be my mistake?
Edit:
I do not find the cause, but I think It was an error with the doftware in my adc class.
Have anybody an Idea why? Or where could be my mistake?
Edit:
I do not find the cause, but I think It was an error with the doftware in my adc class.
Re: ADC and Safe Mode
Almost same problem as you.
I'm trying to read analog sensor in pins from X5 to X8, with values from 0 to 3.3V.
In other analog port I can read it without any problem (example: in X1 to X4).
My really simple code, from an example:
Any idea? Thank you very much.
I'm trying to read analog sensor in pins from X5 to X8, with values from 0 to 3.3V.
In other analog port I can read it without any problem (example: in X1 to X4).
My really simple code, from an example:
Code: Select all
from pyb import USB_VCP
from pyb import Pin, ADC
u = USB_VCP()
adc = ADC(Pin('X8'))
while True:
lectura = adc.read()
print(lectura)
Any idea? Thank you very much.
Re: ADC and Safe Mode
Your example works fine for me.
I connected a 10K pot between 3.3v and 0v with the center tap going to X8, and I get values between 0 and 4095 as I adjust the pot from one extreme to the other.
I tried booting up normally and booting up in safe mode and got about the same vaues from the pot in both cases. Both times I was powered from USB.
I connected a 10K pot between 3.3v and 0v with the center tap going to X8, and I get values between 0 and 4095 as I adjust the pot from one extreme to the other.
I tried booting up normally and booting up in safe mode and got about the same vaues from the pot in both cases. Both times I was powered from USB.
Re: ADC and Safe Mode
for me this is a very strange problem,
I have the problem not with determined pins, but with some parts of the software.
I solved it, by comment some parts of my code and decommant it. So I do not found the reason, but for the moment it works.
If sombody whant to look in my code I can send both versions. ( one is ok abnd one has the error)
@mdblabs:
Do you define the Pins with the problems in other part of the code for an other function?
I makte this mistake at the first, because I include an old part of software that I do not use anymore.
I have the problem not with determined pins, but with some parts of the software.
I solved it, by comment some parts of my code and decommant it. So I do not found the reason, but for the moment it works.
If sombody whant to look in my code I can send both versions. ( one is ok abnd one has the error)
@mdblabs:
Do you define the Pins with the problems in other part of the code for an other function?
I makte this mistake at the first, because I include an old part of software that I do not use anymore.
Re: ADC and Safe Mode
Sure - I can take a look. You can email the good and bad files to dhylands at gmail dot com.