Swagbadge for newcomers to electronics
This guide is for everyone who likes the sound of what the swagbadge can do, or have an interest in learning about some hardware and electronics but just doesn't know where to start, or wants to learn as part of a community. We are here for you! This guide is intended to help you learn, through the development of the Swagbadge or Dagbadge. It (will) have lots of pointers out to resources on the internet you can use for further reference and learning.
- What is a Swagbadge or a Dagbadge?
- The components on the badge
- Some electronics fundamentals
- Software makes the hardware go
- The Aiko framework
- All about SAO - Simple Add Ons
What is a Swagbadge or a Dagbadge?
A swagbadge is the officially branded, fully pre-assembled electronic badge provided to early registrants to LCA 2021. Designed to work alongside the standard paper badge normally provided to participants, it provides a talking point, an access to hardware and electronics, and their corresponding software, and is extensible both now and into the future.
For those who can't get hold of a swagbadge (you registered too late to LCA 2021, you're attending LCA but don't live in Australia, or you're just interested in the process and want to be part of our wider community), there's the dagbadge. This is a list of parts that you acquire yourself (without the LCA branding), designed to be readily obtained from your local or online electronic store. You need to assemble it yourself.
The components on the badge
The swagbadge contains:
- a PCB
- a Lolin32 ESP32 microprocessor
- two OLED screens
- two switches
- two capacitive touch slider controls
- four SAO headers
For the list of parts on a dagbadge, see Dagbadge BOM, but it is essentially the same, but with a breadboard instead of a PCB.
What do all those elements mean?
Imagine that the badge is a creature.
- the Lolin32 ESP32 microprocessor is the brain. It is a tiny computer, designed for embedded/IoT applications, of a type called a ESP32, manufactured to the Lolin32 standard (first built by the WEMOS company but frequently copied). It has:
- 4Mb (?) of flash memory
- Low power consumption for long life when battery powered
- Powered by microUSB - USB, but is capable of handling an external battery if you know how to connect it.
- the PCB is a Printed Circuit Board. It is combination skeleton and nervous system. Like a skeleton, it holds the other parts in place. Like the nervous system, it contains circuitry printed on it to let the microprocessor (the brain) communicate with all its senses, and talk to other devices.
- the two OLED screens are like inverse eyes. They are tiny computer screens, supporting black and white text, pixel and lines display, at a resolution of 128x64 (?). We have provided two so you can use them as one super wide screen, or as two separate screens.
- the two switches are underneath the screens on the swagbadge. Push the screen and it pushes the switch. The software can read the hardware to detect which switch is being pressed, and whether it's a single press or a long press.
- the two capacitive touch slider controls are sensors. As you move your finger up and down the lines, the software can read the hardware to find out (roughly) where your finger is on which slider. They're called "capacitive" because that is the mechanism by which the component works: it uses the capacitance in the circuit, affected by your finger, to tell where you're touching. Your smartphone's screen operates via capacitive touch..
- the four SAO headers are Simple Add On headers, which let you extend the capability of your badge with other components and boards using the SAO standard - there'll be a dedicated Swagbadge SAO wiki page soon(tm).
Some electronics fundamentals
- Extra pins on the board.
- Do not immerse in water/tea
- ... I'm sure I had more to add here.
Software makes the hardware go
The hardware on its own is inert. It doesn't do anything without something to read the sensors, or display information on the screen. So what drives the badge?
- Operating system: the Swagbadge uses MicroPython, a special version of the Python programming language designed for use on small internet of things/embedded devices, just like the badge.
- A framework. This is Aiko for MicroPython, written by Andy Gelme of the Open Hardware team. It provides a whole bunch of convenience functions for writing to the screens, or reading the value of switches. It's also designed to make communicating to a badge over a network a lot easier by providing access to the badge's capabilities via sending simple messages to the badge via an MQTT server. We are using a dedicated MQTT server for the badges, based in Australia so it's nice and fast!
- Applications. Written in MicroPython, these are programs to make your badge do things! Several are provided, to demonstrate some capabilities to help you learn how to use the badge and copy as required to make your own code work.