Chapter 10. Networking
Due to the small size of the devices upon which MicroPython runs, there is no room to add an ethernet socket. As a result, those devices that include capabilities for inter-device communication do so wirelessly.1
There is something strangely satisfying about interacting at a distance: it feels like magic. However, there’s something much better than magic going on: physics! How such communication works is fascinating, and two types of communication will be covered in this chapter: infrared (on the Circuit Playground Express) and radio (on the micro:bit- and ESP8266/32-based devices).
Infrared (IR) communication is most commonly associated with television remote controls: slabs of buttons to be poked and pressed while pointing the device at the TV. Infrared works well over a short distance so long as there’s a line of sight between the transmitter and receiver (hence the requirement that you point the remote at your TV). We can’t see infrared light because its wave length is just below that of visible light.2 There are many sources of infrared light in our environment: the sun, light bulbs, candles, and even our own bodies (our bodies radiate most of their heat in the infrared spectrum). To overcome the potential for interference from such ambient sources of infrared light, when sending a signal it is common to modulate it. In this instance, modulation means the signal is sent at a pre-agreed frequency, the most common being 38 kHz (although other frequencies ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access