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

DE10-Nano adcTest.py not working #20

Open
julisaverdejo opened this issue Jun 1, 2023 · 4 comments
Open

DE10-Nano adcTest.py not working #20

julisaverdejo opened this issue Jun 1, 2023 · 4 comments

Comments

@julisaverdejo
Copy link

Do I need to change anything to run the adcTest.py script, it doesn't work, raw_value is always one, any suggestions?
rsyocto Vers. 1.042

@Andy2No
Copy link

Andy2No commented Jun 8, 2023

@julisaverdejo Are you testing it with a potentiometer wired to 5V (or 3.3V), GND and the ADC pin?

The demo is fixed on ADC channel 0... I'm not sure which end of the header that is on, so maybe try both.

I aim to try this on a DE10-STD, once I get it to boot. They should be the same, in that respect.

If you're using a DE10-Nano, you could also try this:

https://github.com/truhy/f2h_uart_de10nano

  • which needs a microSD card set up with the boot image from there. That worked for me, when I tried it a while ago. While it doesn't answer your question it at least provides another way to see the ADC working.

@Andy2No
Copy link

Andy2No commented Jun 8, 2023

FWIW, this is what I see on the DE10-Standard, without making any connections to the ADC header:

root@cyclone5:~# python3 adcTest.py
ADC readout Demo for LTC2308 ADC with Channel 0
Reading the current ADC value ...
Sample: 99/100
-> ADC CH0: 1700
-> U AVG: 2.0757V
End of demo...

The ADC CH0: value changed, mostly showing 1704 or 1703, with the voltage changing slightly too. That was just due to noise being picked up on the open pin. With a suitably small value potentiometer, it's possible the reading would just be constant.

I'll try it with a potentiometer later.

@Andy2No
Copy link

Andy2No commented Jun 8, 2023

@julisaverdejo I've now tried it, on the DE10-Standard, with a 50k potentiometer, connected to the 5V, GND and ADC_IN0 pins of the 10 pin ADC header. Initially, I got no response, but that's because the diagram of the ADC header in the examples section of the manual is upside down, from the point of view of having the buttons and LEDs facing me, and it's not shown in context - the DE10-Standard manual has a few stupidities in it like that.

Once I connected it properly, it worked fine, changing the value as I turned the potentiometer:

root@cyclone5:~# python3 adcTest.py
ADC readout Demo for LTC2308 ADC with Channel 0
Reading the current ADC value ...
Sample: 99/100
-> ADC CH0: 4233
-> U   AVG: 0.5165V
End of demo...
root@cyclone5:~#

Using a potentiometer with too high a value might give little or no response. I would guess anything from 5k Ohms to 100k Ohms would be fine, but I've only tried 50k so far. A higher value can introduce more noise in the reading, but wastes less current. There shouldn't really be a need to go below 5k.

With a 50k potentiometer, the reading stays stable when I'm not moving it and not holding onto the potentiometer.

@cirofabianbermudez
Copy link

cirofabianbermudez commented Jul 9, 2023

I am also working with de DE10-Nano and when I run the adcTest.py it shows the following output:

root@cyclone5:~#  python3 adcTest.py
ADC readout Demo for LTC2308 ADC with Channel 0
Reading the current ADC value ...
Sample: 99/100
-> ADC CH0: 1
-> U   AVG: 0.0012V
End of demo...
root@cyclone5:~#

I tried all the ADC pins on the board and there is no change.
I already tested the same script in the DE10-Standard and it worked flawlessly,

I am using the version 1.042in the DE10-Nano

root@cyclone5:~# cat /usr/rsyocto/version.txt
1_042root@cyclone5:~#

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

3 participants