Servo RP2040 Sensors detecting PWM signal per sensor

Hi everyone,

I’m trying to understand how to access PWM signal inputs rather than voltage via the Sensor Inputs for the Servo RP2040 board.
The goal is to have the Servo board interpret the inputs, overlay a decisioning logic and output that to the servos.

I have CircuitPython 8.0 installed as i needed I2C slave support.

Using CircuitPython pulseio.PulseIn, I can see 2 pulses being detected, with one returning the right PWM signal of Signal_1 however I have no idea how to take it further. All experimented ways are not identifying per pin signal. I know my execution is wrong but i don’t quite understand how to access each sensor pin across a shared_adc variable so i can then monitor each pin.

Any help would be greatly appreciated :) I would love to be able to read PPM through the signal but currently i’m using the Servo_18 to read the input.

Thanks and love the Servo RP2040 so far.

import time, board
from digitalio import DigitalInOut, Direction, Pull
from analogio import AnalogIn
import pulseio

pulses = pulseio.PulseIn(board.SHARED_ADC,idle_state=True)

addr0_pin = DigitalInOut(board.ADC_ADDR_0)
addr0_pin.direction = Direction.OUTPUT

addr1_pin = DigitalInOut(board.ADC_ADDR_1)
addr1_pin.direction = Direction.OUTPUT

addr2_pin = DigitalInOut(board.ADC_ADDR_2)
addr2_pin.direction = Direction.OUTPUT

def get_voltage(pin):
    return (pin.value * 3.3) / 65536
def select(address):
    addr0_pin.value = address & 0b001
    addr1_pin.value = address & 0b010
    addr2_pin.value = address & 0b100

while True:
    print(len(pulses), end=":")
    if (len(pulses) > 0):
        # Pause while we do something with the pulses

        for i in range(len(pulses)):

        # Print the pulses. pulses[0] is an active pulse unless the length
        # reached max length and idle pulses are recorded.
            print(pulses[i], end=",")

        # Clear the rest
    print("\n", end="")

Output format <pulse_length,pulse[0],pulse[1],…>
pulse[0] i have no idea what this is detecting
pulse[1] is the PWM from the receiver
No further pulses detected despite having inputs into Sensors 3 & 4 | 8.0.0-beta.4\0:

just to understand, are you reading the PWM signals from the servos you’re controlling with the same board?

Reading PWM signals from an RC receiver into the Sensors (1ch per sensor), translating/mixing them to then provide an output via Servos 1-4.

1 Like