Skip to content

Latest commit

 

History

History

avr

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

learn-electronics

Let's learn electronics together.

Overview

Starting with the most basic circuits (and ICs), let's learn electronics via small projects and tutorials that we share here. To start, I'm approaching this with a series of 'hello world' tasks that become increasingly more interesting and more complex.

QuickStart

Starting with just the Arduino IDE, let's start figuring out how to write to a multi-segment LED (so we can eventually write something like hello world to one. Posts 01-05 use C and C++ to write to the hardware.

C/C++

Here we start off using the Arduino IDE, then quickly shift to using Jetbrains CLion with the Arduino plugin. Then there is a little exploration into different OO patterns. However, at the end, my mounting frustration with C/C++ and CMake encourages me to see if Rust can target these devices...

After QuickStart

So Rust can target the ATMega328P! This opens up the whole world of microprocessors to us. So, quickly read The Rust Programming Language. We can use these projects to both learn Rust, microprocessors, and then use both of those to help learn electronics.

Here's where I learn how hard multithreaded programming on devices can be:

The good news is you can use timers without interrupts, and this is easy:




Project (In Detail)

Dependencies

Software

  1. vim

Ha ha. Just kidding. Use whatever operating system, text editor, and other software that you want. I use:

  • gnu linux -> ubuntu distro
  • vim
  • Jetbrains tooling where necessary

Tools

Complete Lab

This is a more or less complete lab setup (you don't need all of this)

Cheap Lab

This is a much cheaper lab setup (you only need some of this)

Minimalist Lab

I think you could bootstrap without a scope, use an old wall wart for a power supply (or scavenge an old computer power supply), create a voltage divider with some resistors, and you are ready to go.

Things I think you need but you can go cheap on:

  • soldering iron
  • wire
  • solder/flux
  • breadboard
  • perfboard
  • multi-meters (2)
  • capacitors
  • resistors

No Lab

For the hello-world stuff, all you need is an arduino, a breadboard, some wires, a resistor, and an 8 segment LED. There are kits to be had for less than $25 that have all this and more. Or skip the kit and use a simulator?

Books

I have these books and recommend each of them:

I buy older books, then when I've read the whole thing (rarely but sometimes happens) I buy the new book. I'd recommend starting with old copies when possible. Note that I'm not going to use C or C++ if I can use Rust. It's a much much nicer language with lots of modern features and it seems to work well even on tiny chips like the ATMega328P.

Websites

Khan Academy Electrical Engineering Series (excellent)

Random learning sites (dunno how useful these are)

Chips

Phase 1 : Arduino ATMega328P

I bought a couple of these on ebay for about $10. Get the UNO R3 with socketed IC so you can remove the chip and embed it on a board later. I also ordered 4 chips with resistor, oscillator, and socket for another $20.

Phase 2 : ESP32-S2 or an STM32F3 Discovery board

The dev kit is about $60 with shipping from digikey:

or we can use the STM Discovery board...

https://www.st.com/en/evaluation-tools/stm32f3discovery.html

I'm not sure which board to use for Phase 2 yet... suggestions?

Phase 3

The F1C100s has 32MB in the chip, and can be had for $1.50 qty 1, less than $1 in quantity. I bought 10 of these for less than $20 including shipping. According to the datasheet, this is an amazing piece of tech with loads of audio visual subsystems...

Goals

Output 'Hello World', or it's equivalent, using increasingly interesting and challenging technologies.

Phase 1

  1. Manually trigger an LED on and off, with a power supply, switch and a resistor.
  2. Manually trigger the segments of a 7 segment LED display on and off, again using just power supply, switches, and resistors.
  3. Use ATMega328P to programmatically control 7 segment LED display, using no libs, just the GPIO pins, power supply, and resistors.
  4. Solder a multi character LED display.
  5. Controll multi character LED display directly via ATMega328P
  6. Solder a SPI|I2C|UART backpack(s) for LED display Note: the backpack needs a micro-controller or a GPIO expander... options are MCP23017, PCF8574, or ATMega328P. Personally, I think the ATMega328P is the easiest choice as it already supports SPI|I2C|UART.
  7. ATMega328P sends 'Hello World' over SPI|I2C|UART to backpack, backpack controls LED display

Phase 2

Using the STM or ESP, output a graphical 'hello world' to a graphical display of some sort.

Phase 3

Using the F1C100s, output 'hello world' using a video codec such as H.264,H.263,MPEG1/2/4 to a graphical display of some sort.

Phase 4

Using the F1C100s, serve the 'hello world' video stream over the internet.

Phase 5

Using an FPGA, output 'hello world'. I have yet to really think about this use case.

Notes

I2C

STM

STM devices can speak many protocols: I²C, IrDA, SPI, UART/USART

This is the backpack that we are basically creating from scratch.

SparkFun 16x2 SerLCD - RGB Backlight (Qwiic) https://www.sparkfun.com/products/16396

"""The on-board ATmega328P AVR microcontroller utilizes 11.0592 MHz crystal for greater communication accuracy with adjustable baud rates of 1200 through 1000000 but is default set at 9600. The firmware for this SerLCD is fully opensource and allows for any customizations you may need."""

Backpack chips

Build up to E-Paper

LED Matrix Display