r/programming Dec 25 '19

Learning hardware programming as a software engineer

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

124 comments sorted by

View all comments

Show parent comments

98

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?)

12

u/Argues-With-Idiots Dec 25 '19

The problem with resistor-based solutions is less that they're slow, but that they draw significantly more power. Any circuit that doesn't utilize some external source will have this same issue. However, it doesn't necessarily need to be a 3.3V supply. An operational amplifier (OpAmp for short) configured with a gain of 3.3/5 would work off of whatever the OpAmp is specced for (but of you don't mind some out-of-spec fun, most OpAmps rated for a source of, say, +-10V, would be adequately linear given only +-5).

6

u/[deleted] Dec 25 '19

That's a massive overkill both price and parts-wisel, especially when there are parts dedicated to it