New board with the RP2040/Pico

There are in total 26 GPIOs available on the Raspberry Pi Pico. I am considering making a carrier board with support up to 5 BLDC motors for the Pico.

  1. For each motor we need 3 pins for PWMs and 1 pin for EN. That means 20 pins are needed for 5 motor.
  2. As for current sensing, I am considering using an LTC24971 16Bit/16 Channel ADC with I2C communication. That’s 2 pins (SCL and SDA)
  3. And AS5047 with SPI communication for the position sensing. That’s 4 pins.
    So all 26 GPIOs on the Pico are used.
    Any suggustions?

I think the i2c current sensing is to slow but I’m not quite Shure on that.

@miraclemelon ,

Welcome and thank you for contributing.

The idea of using Pico in such manner is certainly interesting. I have never used Pico. Can you first ensure SimpleFOC supports Pico, and if the code supports current sensing using i2c as a protocol? Perhaps reading the documentation would really help you in your desicion. I am not an expert in Pico or Simplefoc but have this feeling that you may hit a few bumps on that road. Hopefully others will contribute to your question more productively.


here it is comfired Pico will be supported,also reading current though i2c is’t a problem rpi_mcu

The normal arduino has a 9600khz adc sampling speed(or 9,6ksps) so anything significantly faster than that and with a faster i2c speed should be fine. The propagation delay of the adc does impose limitations on how fast the foc loop can run, however.

I’ve looked at faster, better adcs for current sensing and a reading for two over spi takes around 40 clock cycles, or about a microsecond at 40Mhz. That shouldn’t limit anything. Though it’s good to keep in mind.

Reading i2c with pico isn’t a problem, however, is current sensing using i2c sensors supported by the library? If it’s not then you need at least two analog pins for each motor. Pico has only 3 analog pins, so you may have a problem there. Could you please check?


The library doesn’t support it at present. Though two sensor operation is supported.

Adding it should be fairly trivial though, just a function that gets the phase currents from somewhere.

I’ve done something similar in the past, where I had four motors, so I ended up controlling four individual motor boards (each with small MCUs) with a central powerful MCU (600MHz NXP Cortex-M7) which did the complex calculations and communications, and sent simple commands to the four motor boards. Using a single MCU to control five motors may be possible, however, @miraclemelon will probably need at least one of the high-end STM32 M7 144 pin MCUs. Plenty of pins to work with. Something like STM32H743ZI, or dual core STM32H747 or any other from the H line.

teensy 4.1 could probably do it. it has 35 pwm pins, 18 analog inputs and a very fast processor. though using your approarch with one mcu per motor would definitely be the simpler one.