Cheap microcontroller board that you can find online for <Rs 300/- (~3.5 USD) and is fully programmable.
Got this from a hobby shop online and wanted to try writing some low-level code for it. The whole Arduino IDE and process seemed super unintuitive (abstracts away all the learning). So I decided to try writing a toolchain (using FreeRTOS) and some modules for it manually.
Why this board makes more sense for learning (compared to let's say an ESP32):
- Single-core CPU means you need to control the event loop manually for async operations
- No onboard ROM (only flash storage) means you need to be careful with data management
- No onboard crypto engine means you need to learn how the security features work and implement them yourself :)
- Still getting full control over bootloader/flash storage for a fraction of the price
- An ESP8266 board
- Computer/laptop as the host machine (I'm using WSL on Windows)
- Micro-USB to USB-A/C cable to connect it to your computer
- hello-world - simple hello world on serial console and GPIO pin manipulation
- dht-22 - control and read data from a DHT-22 Temperature and Humidity sensor
- shell - interactive shell with extensible command template, command history, completion and more
- Install
python3,uv,binutils,curl,wget,gcc,git,linux-libc-dev,makeon your host machine using your package manager. - Clone this repository
git clone git@github.com:vishnuvardhan-kumar/esp8266.git
cd esp8266/
- If you have
direnvinstalled and configured, it should kick in and set up some config automatically. I highly recommend using this! If you decide not to, open the.envrcfile and add the configuration to your environment manually. - Set the
setup.shfile executable and run it to download the toolchain and SDK.
chmod +x setup.sh
./setup.sh
- Spin up the
uvvirtual environment and sync packages.
uv sync
# (activate the virtualenv if not using direnv)
- Navigate into the directory and run
make menuconfig
cd hello-world/
make menuconfig
- If the project make linkage worked correctly, it should now show a TUI with configuration options. I have set sane defaults for almost everything, ensure to change the
Serial Flasher Configto the device name for your USB serial port (Eg:COMxon Windows,/dev/ttyUSBSnon Linux)
-
Save and quit the visual interface with
Esc-Esc. -
Now you have a bunch of
maketargets to play with the project:
make app # compile only the application
make all # compile application + libraries
make flash # compile all, flash the executable to the target serial device
make monitor # open up a serial monitor for I/O
- You should be able to get up and running by using!
make flash monitor
- Post the flashing sequence - you should be able to see a message on the Serial Monitor and a blinking onboard LED.