Sipeed Maixduino how can I Analogread

I have recently bought a new board for one of my projects. The link is below.
I can't do Analogread with it although the board owns some analog pins. As I know those pins are owned by the esp32 integrated on the board. Is there any way that I could do Analogread with this board?

Oops, please correct that!

Ah, thanks, the link now works.

Please post a complete sketch showing what you tried, a schematic of how the hardware was set up and describe what happened

Although this board has an Arduino Uno form factor, there is nothing on the page you linked to that clearly indicate that it can be programmed like an Arduino or with the Arduino IDE. So I'm not sure if anyone in this forum will be able to help you with it at all, let alone how to achieve something that the board's designers may not have foreseen the need for. Perhaps Sipeed have a help forum?

I found this.

Analog I/O
Maixduino uses the pwm module of the K210 chip to implement the analogWrite() function. The analogRead() function is temporarily unavailable.

In Maixduino, you can configure up to 12 pins of the 48 FPIOs to be Analog Output.

From this site;

Tom.... :grinning: :+1: :coffee: :australia:

Sorry for not including necessary documentation in my post.
Here are some links for the Maixduino board:

I tried to read a Value from an LDR via analog Pin A0. It worked perfectly fine in my other arduino boards(arduino due, arduino uno) but when I tried to connect it to Maixduino it always reads '0'. Hence if I change it to anlaogPin3 it reads 3, if I write analogRead(A33) it reads 33. There is most probably a problem that I am dismissing because I can do anything else with the board other than "analogRead()".

Here is the code:
#define LDRPIN A0
int LDRVal;

void setup() {
// put your setup code here, to run once:

void loop() {
// put your main code here, to run repeatedly:
LDRVal = analogRead(LDRPIN);

I couldn't upload the schematics of the circuit since there was a problem with it. But it is just basically similar to the sketch here: with the only difference being that there is a Maixduino instead of an Arduino.
I also know that this board can be programmed with micropython but I have no experience in programming with micropyhton therefore it wouldn't be useful for my project.

Thank you Tom.

If you are really wanting to use this board, then there are other ways of analog measuring.

You can time the period it takes for the sampled voltage to charge a capacitor.

Or use PWM output to a LP filter and compare the sample voltage with the filtered DC from the PWM.
As you ramp up the duty cycle, the filtered voltage increase, the comparator will tell you when it is higher than the sample voltage.
You can calibrate PWM duty to the filtered DC and use that to give you a reading.

Just a thought.. Tom... :grinning: :+1: :coffee: :australia:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.