Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

[TimeoutError]: read_raw: channel X conversion timed out

126 Views - Created 05/06/2023

05/06/2023

Posted by:
Suhyun

Suhyun Avatar

Hello abelectronics.

your ADC Pi s doing a huge role in my project. Thanks for great work.

I've built the circuit connecting Raspberry pi Pico W and ADC pi, activating 3 channels(1,2,8) and it works well at first. However, after 2~3 minutes or longer, it throws out the error like:

[TimeoutError]: read_raw: channel X conversion timed out

The timeouterror did not happen when I built the same system with Raspberry pi 4, but It started happening at connection with Pico W(fyi, I used different ADC pis, but I've build 3 same circuits and the error happens same at all 3, i think faultiness of a single one is not the problem).

Channels throwing out TimeoutError are random.

I searched on the forum to find some clues, and found some library modification was done for full-sized raspberry pi boards but I'm not sure it was done for micropython library(https://github.com/abelectronicsuk/ABElectronics_MicroPython_Libraries) as well.

If it was done, can I get some clues about causes of TimeoutError I mentioned above to fix my work?

Sorry if the question was stupid, and if more information is needed, I'd be more then happy to give it to you.

Regards,
Suhyun

05/06/2023

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

Hello Suhyun

The timeout error could be cause by the ADC library not giving the Pico W enough time to fetch the ADC sample.  Try modifying the ADCPi.py library to increase the timeout_time value and see if that fixes the problem. 

On line 218 in ADCPi.py change:

timeout_time = time.time() + (100 * seconds_per_sample)
to
timeout_time = time.time() + (1000 * seconds_per_sample)

06/06/2023

Posted by:
Suhyun

Suhyun Avatar

Dear Andrew.
Your solution absolutely fixed the problem. I ran the code for last 12 hours and it worked well.
I appreciate your help. Have a nice day.
Suhyu

Sign in to post your reply

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.