1
\$\begingroup\$

The Goal

I have a Raspberry Pi that I'd like to control my treadmill with. The Pi's GPIO ports output 3.3v and the treadmill's motor control board only takes 5v signals. Because of that, I bought a bi-directional logic level converter.

The Problem

You can imagine how bad it would be if I hooked up my Pi to the treadmill, and off-the-bat, the treadmill is receiving a solid 5v to the speed wire. I want to avoid that.

I've hooked up the LV to 3.3v and HV to 5v and attached grounds on both sides of the logic level converter. Now, right off the bat, touching my multimeter to Ground + LV1 shows 3.3v. Worse, touching HV1 shows 5v (meaning the nightmare scenario would have happened if this was plugged in.)

I recorded a video of me touching different parts of the converter and saying the results.

Things I've gathered this far.

If the Raspberry Pi's GPIO is not explicitly programmed to output a HIGH or LOW signal, it becomes like an "antenna". I've learned luckily that setting a pin explicitly to LOW and plugging it into LV1 will output 0v on HV1. The problem is that the Pi takes time to boot and launch my program, so I fear if a restart were to occur, the treadmill would receive full 5v to speed for 30 seconds while it booted.

Extra details

For this project, I have four wires I'm connecting from my Pi to the Treadmill: Incline Up, Incline Down (both take a solid 5v signal to activate), Speed (PWM 5v signal), and a tachometer(?) wire (diagram said it could be used to track footsteps.) Of these 4 wires, 3 of them are outputs and 1 of them are inputs.


Any advice is appreciated, thank you for reading this far!

\$\endgroup\$
1
\$\begingroup\$

Add a pulldown resistor (a 1k or so resistor to ground) to each input of the level shifter that you need to protect from erroneous activation. As a result, when the Pi is not driving the line, it defaults to logic low, and the level shifter outputs will only be high when the Pi is actively driving the corresponding inputs high. When high, about 3.3mA will be drawn from GPIO pins to overcome the pulldown, which is within recommended limits.

Note: The level shifter includes its own pullups (which cause the output to default to high), with value 10k. When the signal is low, both pullups on each channel need to be overcome (the LV pullup directly, and the HV pullup because the FET will conduct). Your pulldown resistor should have a value that is small enough to be able to overcome these pullups.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Thank you Andrey! So to clarify, let's say I want to output using my Pi on LV1 and the corresponding HV1 would plug into my treadmill control board. I would have a resistor plugged into my Pi's ground and then plugged into HV1 - that would stop it from defaulting to HIGH, yes? \$\endgroup\$ – NessDan Aug 31 '18 at 22:37
  • 1
    \$\begingroup\$ @NessDan No problem. Please see post edits as I reviewed the schematic for the level shifter and adjusted the recommended pulldown resistance. \$\endgroup\$ – nanofarad Aug 31 '18 at 22:38
  • \$\begingroup\$ Thank you, I also made an edit to my comment above :) \$\endgroup\$ – NessDan Aug 31 '18 at 22:41
  • 1
    \$\begingroup\$ @NessDan The pulldown resistor needs to go between your Pi's ground and LV1. It will pull LV1 down. \$\endgroup\$ – nanofarad Aug 31 '18 at 22:43
  • 1
    \$\begingroup\$ @NessDan That's correct. You will need four. \$\endgroup\$ – nanofarad Aug 31 '18 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.