1

Is there a way to change arduino analog reference to EXTERNAL IN PYTHON using pyfirmata or any other library ? Necessary Links : https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference/

My sensor has a 3.3 volt operating voltage , my arduino has a 5 volt operating voltage. As such in arduino using C++ and arduino module the scaling can be done using analogReference(External) and providing reference voltage to analog read?

IS there any equivalent to this in python, pyfirmata ?

1 Answer 1

0

No, not as far as I know. The firmata protocol does not include a command to set the analog reference. However, you can of course modify the firmata firmware to your liking. In the simplest case, just add the appropriate command to the setup() function of the main .ino.

2
  • I have been using pyfirmata for the previous projects. Since pyfirmata doesnt include the necessary function , you suggest adding analogreference(External) to the firmata module that i would have to upload and run on arduino , would that make the analog reference voltage external when accessing with pyfirmata and python? May 3, 2021 at 20:24
  • @Shahanhasan Yes. Firmata doesn't use analogReference() anywhere in the code, so when you add analogReference(EXTERNAL) to the startup code, it should change the behavior when accessing it from pyfirmata.
    – PMF
    May 4, 2021 at 5:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.