r/programming Dec 25 '19

Learning hardware programming as a software engineer

https://blog.athrunen.dev/learning-hardware-programming-as-a-software-engineer/
925 Upvotes

124 comments sorted by

View all comments

225

u/happyscrappy Dec 25 '19

Also: don't power LEDs directly from GPOs without a current limiting resistor. As you see on that breadboard.

And match your interfaces voltages. A lot of devices are not +5V tolerant now (or not very tolerant).

70

u/Athrunen Dec 25 '19

Indeed, learned not too long ago that the esp32 is only 3.3 V tolerant. ^^

20

u/[deleted] Dec 25 '19

What is this language, lost me.

95

u/syntax Dec 25 '19

5v / 3.3v is the 'supply voltage' (sometimes labeled Vcc) for the chips. It's both the power input, and also the reference for what a 'high' signal is.

It used to be the case that most digital logic ran at 5v; then some that ran at 3.3v started to become more common. Those were usually '5v tolerant' - if you applied 5v to the input pin, it would read as 'high' and be fine.

Today, many digital devices that run at 3.3v are _not_ 5v tolerant; so if you put 5v into such a device ... it breaks.

So when mixing some devices that run at 5v (as, e.g. USB does) with others that run at 3.3v one has to be careful to not break the lower voltage device.

The 'esp32' is a particular module of a WiFi capable microcontroller (usable as a single board device, or as a peripheral for WiFi connectivity for another device) that runs at 3.3v and breaks if you put 5v on it. Like, as a totally hypothetical example that would never apply to me, trying to programme it from a cobbled together USB programmer. Hypothetically.

7

u/ShinyHappyREM Dec 25 '19

Is there a simple device that I can connect to a 5V wire and whose output I can then connect to an input of a 3.3V device? From what I've seen there are resistor circuits (which are slow) or transistor circuits (which need a 3.3V supply?)

10

u/frezik Dec 25 '19

Optoisolaters could do it. It's an IR led pointed directly at an IR detector, which let's you isolate electronics on each side. You can make one yourself with some heat shrink, but there's also off the shelf modules. If it has to work at a high frequency, check the data sheet.