Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

How to set gain on ADCPi?

The ADC Pi is an Analogue to Digital converter for the Raspberry Pi

09/05/2023

Posted by:
icenov

icenov Avatar

Hi

I'm using python3 and can read voltage on each channel OK, but I can't work out how to set the gain.

For example, using the demo_readvoltage.py script, how do I set the gain? I've tried using adc.set_gain(8) but it doesn't seem to make any difference...

Does anyone have a python example I can tryy?

Thanks

09/05/2023

Posted by:
icenov

icenov Avatar

09/05/2023

Posted by:
icenov

icenov Avatar

OK - I think I understand how it works now: voltage doesn't change but more resolution. And max voltage decreases with gain. I just wasn't sure if it was actually doing anything until I noticed that the readvoltage value was topping out at lower and lower values as the gain was increased.

09/05/2023

Posted by:
andrew

andrew Avatar

Hi

You are correct; when you set the gain to a higher value, it will read the same voltage level, but the maximum voltage decreases, and the resolution increases.

On the ADC Pi, the gain values will give the following maximum voltages.

1 = 5V

2 = 2.5V

4 = 1.25V

8 = 0.625V

13/05/2023

Posted by:
icenov

icenov Avatar

Just to check - are these +- values or just positive values?

13/05/2023

Posted by:
andrew

andrew Avatar

On the ADC Pi you can only measure positive values. To measure negative values we sell the ADC Differential Pi which has a voltage range of -2.048 to +2.048V.

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.

Home

Shop

Learn

Forum

FAQ

Contact

0 item

Your cart is empty

Please browse our shop to order from the wide range of Raspberry Pi boards and accessories.

Subtotal:£0.00
View Basket Continue to Checkout