Microcontroller Trainer Rev 2
Welcome to the Practical IOT Trainer wiki page.
- 1 [Click Here To Order a Microcontroller Trainer on Tindie!]
- 2 Project Update
- 3 Support
- 4 Project Background
- 5 Disclaimer
- 6 Bill Of Materials
- 7 Theory of Operation
- 8 Assembly
- 8.1 Surface Mount Parts
- 8.2 Through Hole Parts
- 8.2.1 Resistors
- 8.2.2 Ceramic Capacitors
- 8.2.3 LEDs
- 8.2.4 Pushbutton Switches
- 8.2.5 Electrolytic Capacitors
- 8.2.6 Headers
- 8.2.7 Installable Modules
- 8.3 Demo Code
- 9 Errata
We have begun the development of the Rev 3 board. Currently it's looking like Q1 or Q2 of 2021, so there is plenty of life left in rev 2. We still have kits available for version 2 (Click below to go to our tindie store), and will have upgrade packages available for people who want to move to the version 3 kit, so please don't let this discourage you from getting the rev 2 board - we have an upgrade path (at a discount) for you when rev 3 is released. Check out the Rev 3 project page here.
For support, we have started a Discord server. Click the link below to join.
The purpose behind this creation is simple - clean up my desk (while so far it's failed at ACTUALLY resulting in a clean desk, it has been super useful). I do a lot of electronics prototyping and experimenting, and most often my various projects use the same types of elements every time - displays, blinky lights, rotary encoders, etc, although from time to time I bounce around from microcontroller to microcontroller, depending on what might be best suited for a given project. Rather than constantly having to try and find all of these things, I decided to design a PCB around them, so they were always 'at the ready' and 'center of workbench'. This project is the result of that work.
I'm a hobbyist. The trainer board was originally designed for my own use - I never intended to kit it, so there are a few things that are still a little rough around the edges. I didn't worry about sequential naming of all of the components, there are a couple silly silkscreen mistakes, I didn't optimize the power supply design, and there are a few quirks - but all in all, it's a super useful project, so I'm making a few kits available to share it with people. I may continue to make improvements in the future, but for now I'm mostly leaving it 'as-is' - it works.
When you open your kit, you should inventory the parts. The following bill of materials includes information on the parts that are included.
Bill Of Materials
|ESP32||1||ESP32 DevKit C|
|TFT||1||2.4" Touch TFT|
|OLD - New kits will ship with the AT-09 BLE module - HC-05||1||HC-05 Bluetooth Module|
|AT-09||1||AT-09 Bluetooth Low Energy 4.0 Module|
|DC-JACK||1||DC Barrel Jack|
|REG1||1||LM317 Voltage Regulator|
|REG2||1||LM317 Voltage Regulator|
|NANO||1||Arduino Nano V3|
|S1,S2,S3,S4||4||Momentary Pushbutton Switches|
|WS2812B||4||RGB Serial LED|
|ENCODER1||1||Rotary Encoder with Knob|
|ENCODER2||1||Rotary Encoder with Knob|
|MHEAD||5||Male Breakaway Header|
|C1||1||Electrolytic Cap 470uF|
|C2,C3||2||Electrolytic Cap 10uF|
|C4,C5,C33,C36||4||100nf Capacitor (.1uF)|
|OLD - NO Longer Using These Values for C33,C36||2||1uF Capacitor (1uF)|
|Various||Various||Female Pin Headers|
|Various||Various||Male Pin Headers|
|WIRES||1||Dupont Jumper Assortment|
|R45||1||750 Ohm Resistor|
|R44, R46||2||240 Ohm Resistor|
|R47||1||390 Ohm Resistor|
|R1,R2,R3||3||330 Ohm Resistor|
Theory of Operation
The board was designed to be powered by the DC Barrel Jack, which can accept 9-12vDC input. (The silkscreen says 6v, but we've noticed that 6v may be just a tad too low to get the desired 5v output. 9v seems more reliable.) The DC input is regulated down by REG1 to 5 volts. This is our 5 volt rail. Our 5 volt rail is then regulated down to 3.3v by REG2. This was a design compromise to keep the input voltage of REG2 as low as possible. It also allows you to have two voltage rails (5v and 3.3v) while supplying the PCB only a single voltage source. Many of the supplied microcontrollers can be powered by their USB connector and back-power the 5v rail of the PCB. Note: If you apply power to the 5v rail, you will get both 5v and 3.3v output voltages, however if you try and back-power the 3.3v rail, both the 5v LED and 3.3v LED will light, due to the protection diode on the voltage regulator, but this is an erroneous reading. Do not attempt to back-power the board with 3.3 volts, you'll get a 3.3v rail, but your 5v rail will not be functional. Future design enhancements may address this.
Surface Mount Parts
There are several surface mount parts on the trainer board. They can all be hand-soldered, or you can use your favorite SMD assembly method, be it hot air, hot plate, reflow oven, etc.
Parts Required: RGB1,RGB2,RGB3,RGB4
Note: New kits have started to ship with SK6812s rather than WS2812b's.
We begin assembly with the WS2812B LED's. You can use either a surface mount soldering technique, or just a soldering iron with a fine tip to solder these LEDs. I would recommend a little bit of tacky flux to help your soldering process, and to hold the part in place as you solder it. Be sure to orient the LEDs as show in the photo here. Personally, I use a hot air gun, but you have to be careful not to overheat the LEDs or they can melt or fail. WS2812B's are fussy little devices. The can absorb moisture in storage and fail during soldering, they can spontaneously blow during use, and can just be an all around fussy beast... but I still love them. If by chance you destroy one during assembly, don't worry, they're easy to replace and they're cheap and readily available. Rumor has it that the clones are a bit more reliable, so you might even be so inclined as to throw away the included WS2812B's and source your own SK6812s instead. R1 is installed (330 Ohm) as a current-limiting resistor on the data line of the LEDs to help prevent failures due to overcurrent on the data line.
Next we will assemble the power supply section. The power supply is made up of two (2) LM317 voltage regulators, a few capacitors to smooth the DC, and a few resistors to set the output voltage. Capacitor footprints are through hole for easy soldering, while resistor footprints support either through hole or 0806 surface-mount parts. Power is supplied through a 2.1mm DC Barrel Jack. Each LM 317 can supply roughly 500ma of current, so avoid exceeding the rated power or you may damage an LM317. The trainer board is designed with this in mind, and you only connect power to things you're actually using.
Parts Required: REG1,REG2
Install the voltage regulators (REG1, REG2). They are both LM317's and either regulator can be installed in either footprint.
Parts Required: D11,D12,D13,D14
Install the diodes (D11, D12, D13, D14). When installing the Diodes, the cathode (end with the stripe) should orient towards the bottom of the board. The diodes are used as part of the voltage regulator circuits and are all the same. Values/markings may vary.
Through Hole Parts
Parts Required: R1,R2,R3,R44,R45,R46,R47
Install the resistors next. The board supports both through hole or 0805 SMD resistors. I include through-hole resistors when you buy the trainer in kit form from me. R1 is a 330 ohm resistor, and is used in conjunction with the RGB LEDs in order to limit current on the data line. R2 and R3 are also 330 ohm resistors, and are used to current limit the red power rail LEDs. R44 (240 ohms), R45 (750 ohms), R46 (240 ohms), and R47 (390 ohms) are used to set the output voltage of the LM317 regulators.
Parts Required: C4,C5,C33,C36
You should now install the capacitors C4, C5, C33, C36. These are non-polarized, .1uf, (marked 104). Stand them on end as shown in the power supply photo.
Note: In older boards (Before 07/2020), I used 1uf Capacitors for C33, C36. If your kit shipped with qty 4 .1uf's, use .1uf capacitors in place of the 1uF Capacitors. It really doesn't matter much for the purpose of these high-frequency filtering capacitors between the two values, but by moving to .1uF for both I can reduce the parts count. OLD Instructions said : Next, install the capacitors C33, C36. These are slightly larger than the two you just installed. These are also non-polarized, and 1uf (marked 105). Stand them on end, the same as C4 and C5. I prefer end-mounting axial capacitors like shown. Alternatively, this same footprint could support other types of ceramic capacitors - we have some flexibility in the design here.
Parts Required: LED1,LED2
You should now install the red power rail LEDs. Orient the LEDs with the short lead towards the top of the board. Newer revisions of the PCB will include a + marking to indicate polarity more clearly.
Parts Required: S1,S2,S3,S4
Install the push button switches next. Be sure to press them tightly against the board while soldering so that they will sit flat.
Parts Required: C1,C2,C3
I would now install the electrolytic capacitors C1, C2, and C3, paying close attention to polarity. We don't want them exploding now, do we? The smaller two are 10uF and go into C2 and C3, the larger is a 470uF and goes in C1.
This is a great time to test the power supply section, before you solder anything else onto the board. If you plug the power supply in (9-12v DC is perfect) you should have two glowing LEDs. These are power indicators for the 3.3v and 5v rails. If they don't light, troubleshoot and fix the power supply section before continuing on. Using the on-board power supply is purely optional. You can back-power the board from your favorite microcontroller, or source voltage directly to the power rails on the breadboard, and wire it to back-feed the board. Heck - you don't even have to build the power supply section if you're going to do this, but I would recommend at a minimum installing C1, C2, and C3, regardless of how you power the board.
Parts Required: Male and Female Headers - Cut / Snap to size as needed
Use headers where you want to, or omit them, the choice is yours. The headers with the jumpers will go up on the OLED, both for pin assignment selection, and voltage selection.
The headers come next. The headers above and below the breadboard are the most difficult to align, but I have an assembly tip to help you along. They are aligned vertically on a 2.54mm grid, so you can use the extra 40-pin female header as a 'helping hands' to cluster them together during installation, which keeps them parallel and aligned.
Parts Required: 2.2, 2.4, or 2.8 TFT,OLED,ENCODER1,ENCODER2,NANO,ESP32,ESP01,HC-05
You can install the remaining modules in whatever order you prefer. This includes the displays, the microcontrollers, and some accessories.\
Depending on when your kit was shipped, and what was available at the time, your OLED may be white, or it may be bi-color (most often these are 2 rows of yellow, and the remaining rows in white). They function the same, and you can interchange them if you have different modules in your parts bin.
The trainer board is designed to allow support for 3 different popular TFT displays: 2.2 inch without touch, 2.4 inch with touch, and 2.8 inch with touch.
The pin configuration for the TFT and touch section are the same on all 3 boards, however the way they will fit on the board varies slightly. The footprint shown on the PCB itself is designed around the 2.4 inch with touch, but sometimes these can be hard to source. You can plug in the 2.2 and 2.8 inch versions as well, but the SD card connector won't line up, so keep that in mind. Your kit may have come with any of the 3 screen options, but I try to ship the 2.4 inch version when I can get them. Newer board revisions will eventually include footprints for the 2.8 and 2.2 screens as well.
Depending on the HC-05/AT-09 bluetooth module shipped with your kit (or sourced yourself) , you may find different orientations of the headers. You can either leave the right-angle headers on the boards and let the bluetooth module stick up towards the sky, or you can remove the right angle headers (carefully) and replace them with straight headers for a flush mount. It's a quick and easy task to snip the headers off, de-solder them, and attach new headers in whatever orientation you prefer.
UPDATE 12/2020: I have started shipping new kits with the AT-09 bluetooth module instead of the HC-05. This is an upgrade, in a sense that we're now able to prototype with BLE 4.0 instead of just Bluetooth 2.0.
I'm currently developing demo code for the board to make testing after assembly easy, and I'll post it for download when it's ready. Most of the community libraries and techniques work, so you probably already have better demo code than I'll write :)
The rev 2.0 PCB has a couple of silkscreen erorrs, but nothing too significant.
1) There is random text 'HC-05 Bluetooth Module" to the left of the ESP-01. Just ignore it, this was supposed to be deleted.
2) On the header pins for the ESP32, VIAs are obscuring the ESP32 3V3 silkscreen (and I misspelled it ES32 3V3 anyway). Should be self explanatory.
3) On the Arduino Nano header pin, I call out 'UNO 3V3' which should say 'NANO 3V3'
These are all cosmetic and should not affect the boards use in any way. These errors will be corrected when the Rev 3.0 boards come out (and they'll likely include some errors of their own). No ETA on Rev 3.0 release yet, but I'm hoping it will be still in 2020.