M5Stamp power function
2022-03-31 | By M5Stack
License: General Public License Arduino
* Thanks to the project info and source code provided by @Enrico Casti
Things used in this project
Hardware components
M5Stack M5Stamp Pico DIY Kit
Generic L298N H-Bridge driver
I connected my M5Stamp to a small H-Bridge made with L298 compatible chip, small enough to fit inside a Lego Power Function IR receiver shell. The bridge is powered from the battery pack at 9V, while an AMS1117-3.3 provides the to 3.3V compatible with the M5stamp. Since I'm not using 5V in any place, I'm not providing this voltage to the board.
The pin selected for output and connected to the IN pins of the chip L298 are:
- G26
- G18
- G19
- G21
I skipped G36 because that pin can work only as Input
After connected everything, I put the board inside the shell. Unfortunately, the LED and the G39 Button are not accessible from the front.
Software
After installed the latest version of UIFlow (Pico) from M5Burner, I was able to connect to the chip from my preferred web tool.
I use UIFlow on M5stamp because it's so easy and doesn't require USB adapters after burning initially the chip.
Tests
On test one, I just changed the color of the LED, to verify connectivity to UIFlow.
The second test involve the motors, and just powering them for 1 second to check if everything works as expected, and it did. On the third test, I configured 2 PWM, to verify the capabilities of controlling the speed. Now that everything works properly, I have the full flexibility of installing anything via Arduino or UIFlow, I prefer the second one as it doesn't require any USB to serial adapter.
Not sure if I will change something there, maybe I can make available the grove port to use with additional peripherals, as most of them are compatible with Lego.