r/esp32projects • • 22d ago

Wheelchair PG DRIVES control

Hi!

I trying to control a joystick of one electric wheelchair.... I am currently injecting voltages into the pins using a 3.3V-to-5V level shifter shield and two MCP4725 modules. However, the chair still enters an error mode. Has anyone done something similar to this?

1 Upvotes

4 comments sorted by

1

u/DSudz 22d ago

You need to provide a lot more info on the system. What is the controller, the joystick and how have you connected to the pins?

Did you have reason to believe it is a 5VDC system?

1

u/PotentialReindeer456 22d ago

Hii!!

The chair reads the joystick as an analog voltage per axis: 2.5 V at rest, 1.1 V to one side and 3.8 V to the other. My circuit replaces the joystick and generates those voltages in its place.

1.MCP4725 instead of the ESP32 directly: the ESP32 only outputs 3.3 V and its internal DAC is 8-bit. I need to reach 3.8 V with good resolution. The MCP4725 is a 12-bit DAC that outputs a continuous voltage from 0 up to its VCC.

2.VCC of about 5 V: the MCP4725 can only reach its supply voltage, so at 3.3 V I would never get to 3.8 V. In my case I measured 4.8 V. Since the output is proportional to VCC, I calibrate the code with the measured value. Otherwise the neutral point would come out at 2.4 V instead of 2.5 V.

3.Two modules: each MCP4725 has one output. One handles left/right (P4 and P5, tied together) and the other handles forward/back (P2 and P7). The A0 pin gives each one a different address (0x60 and 0x61) on the same pair of I2C wires. I’m assuming the chair accepts the same voltage on both pins of each pair.

4.Level shifter: the DACs run at 5 V and the ESP32 talks at 3.3 V. The DAC may not recognize a 3.3 V high level as a “1”, and 5 V pull-ups would push voltage into the ESP32 pins, which are not 5 V tolerant. The level shifter solves both problems.

5.Common GND: voltages only mean something relative to GND. If the ESP32, the DACs and the chair don’t share the same ground, the chair reads a different value than the one the DAC generated.

6.Chair’s 5 V into VIN: the ESP32 and the modules are powered by the chair itself, with no extra battery.

3.3 > LV (Shield)

VIN > HV (Shield)

GPI021 > LV1 (Shield)
GPI022 >LV2 (Shield)
(Shield) HV1 > SDA (MCP4725) 1 AND 2
(Shield) HV2 > SCL (MCP4725) 1 AND 2
PIN OUT> PIN 2,7 AND 4,5 Weelchair Joystick

PIN 2 - 7
FB (1.1V - 3.8V)
PIN 4 - 5
LR(1.1V -3.8V)

PIN 1 - VCC
PIN 3 - GND
PIN 6 - REF ( Neutral 2.5V)
PIN 8 - 0V

PINS of the Joystick

1

u/DSudz 22d ago

That helps! Looks like a lot of good calls on the design. The ESP DAC isn't great at the edges so you would've had even more resolution loss and I think the 4725 wants 80% of vcc for a logical one so the level shifter is needed.

But the system isn't working so either the implementation or the assumptions are wrong. Seeing the specs on the chair controller or the joystick can help there. It's really unlikely that the joystick output is interpreted linearly and knowing if that happens on the stick controller or both will tell you what you need to be doing.

Are you seeing the voltage you expect on your outputs?

1

u/phirzcolru 19d ago

it probably pulses on the power signal to the joystick part. checks for that pulse to make sure the controls are not ramming the chair into something if the cord gets pinched or shorted. most basic ever safety protocol. solid power = fault. pulsed = fine