Analogue read on the gpio pins from Python or Scratch?

I see a write_gpio and digitalread_gpio but nothing that sounds like an analog read in Python API. Am I missing something?

If this did exist, would it suffer from same bug discussed in python get_motor_current always 0.0 and Socket API problem ?

I am also seeing an issue with Scratch. The Input block returns 0 or 1 and I cannot work out how to set the input to be an analogue voltage?

<hr>

Whilst I'm here, is the Rick board capable of analogue out on GPIO pins?

Discussion

Leave a comment and join the discussion here


Please Log In or Sign Up to write a comment response

4 Responses

Antoon

would it be possible to disconnect one of the motors (like the eyes) and use it's pin as a gpio, or would this require the firmware to be updated?

12:14:21, 07th October 2019   |   Permalink   |   View Source
[deleted]
09:48:41, 27th September 2018  *
mikeprotts

I wonder if the motor monitoring could be performed on one ADC handling multiple channels, and then the other ADCs being available for users with perhaps one channel each. I think the chip is STM32F446RE, which has 24 ADC channels via three ADCs, although there are likely to be several not available due to pin function conflicts. There are also 2 DACs, but again I don't know if there are sufficient pins available for these to be made available.

I'm using the STM32F407 (for a different project) with ADC1 as a monitoring port on several channels, and ADC2 and ADC3 (and an SPI channel) collecting at a fairly high speed, and this seems to work well. I can provide more details off forum if that might help.

Mike

20:50:03, 19th February 2018  *   |   Permalink   |   View Source
sandy STAFF

Hi kjw,

Short answer is that the GPIO pins aren't currently capable of analog IO - we used up all the available ADC ports with things like the motor current sensing and battery monitoring.

That's one of the things I really want to fix with a future update for the control board, as I'm really not happy having no easy analog IO. We could put out an i2c breakout board with analog interfaces perhaps...

The chip we use does have a DAC for analog output - it's tied to the buzzer at the moment via a small amplifier. If you want to do it the old fashioned way, you could use a few digital IO channels, some resistors and and op-amp

Sorry about that

Sandy

00:49:10, 26th January 2018   |   Permalink   |   View Source