What Do I Build Next? I don't normal start with the finished video...but
Well, it's been a few months since ( November 2020) my last two builds:
" https://www.hackster.io/alien-energy-3/what-do-i-build-next-two-mecanum-bots-part-1-a58387 " and
" https://www.hackster.io/alien-energy-3/what-do-i-build-next-two-mecanum-bots-part-2-6fd7c6 "
... I will also be posting alot of product "url's" and screen shots with content from other noteworthy websites within the body of this writeup.
but I've been busy ordering from AMAZON and ADAFRUIT Industries...thankyou UPS, USPS, FEDEX, and DHL for prompt delivery (less weather delays) and NO LOST PACKAGES!!!!!
I built another PC based upon the x79 Motherboard from China (a very slow boat for delivery), " Amazon.com: Adanse X79 Motherboard LGA2011 Combo with E5 2620 CPU 4-16GB(4X4GB) DDR3 1333Mhz NVME M.2 SSD Slot: Electronics " (maybe another "What Do I Build Next? " project release).
I built another Raspberry Pi based Smart Robot by Sunfounder " Amazon.com: SunFounder Raspberry Pi Smart Video Robot Car Kit for Raspberry Pi, Supports Ezblock/Python Code Control and Web Control. Multifunctional Electronic DIY Raspberry Pi Robot Kits for Teens and Adults.: Toys & Games " ( maybe another "What Do I Build Next? " project release).
I advanced tested a new Raspberry Pi based product from Sunfounder called "PiSloth" (a soon to be documented project)
and NOW, two/three Mecanum Robots based upon the newly released Raspberry Pi Pico RP2040, ATMegaZero, and ATMegaZero-ESP32-S2 micro computers. The ATMegaZero intrigued me because of its 40 pin GPIO Raspberry Pi type header.
It all started with a couple of products from Adafruit: Adafruit's 48mm mecanum wheels " Right Mecanum Wheel - 48mm Diameter - TT Motor or Cross Axle ID: 4678 - $4.95 : Adafruit Industries, Unique & fun DIY electronics and kits ", " Left Mecanum Wheel - 48mm Diameter - TT Motor or Cross Axle ID: 4679 - $4.95 : Adafruit Industries, Unique & fun DIY electronics and kits " and metal geared DC Motors " TT Motor All-Metal Gearbox - 1:90 Gear Ratio ID: 3802 - $5.95 : Adafruit Industries, Unique & fun DIY electronics and kits " You can power these motors with 3VDC up to 6VDC. I was very much interested in the mecanum wheels cost, usability, and the performance of the metal geared DC motors. You can power these motors with 3VDC up to 6VDC.
Adafruit also had in stock " Raspberry Pi Pico RP2040 with Loose Headers ID: 4883 - $5.00 : Adafruit Industries, Unique & fun DIY electronics and kits " so I ordered three to test with.
From Adafruit's product description: " At the time of launch, there is no Arduino core support for this board. There is great C/C++ support, an official MicroPython port, and a CircuitPython port! "
What was I getting myself into...I haven't worked with Micro or Circuit Python too much. I naturally, ordered three boards and some accessories. Well I was going to learn to code for either the L9110S (without pwm control) or L298N (for pwm control) motor controllers and again the PCA9685 PWM controller.
I had envisioned this Mecanum wheeled platform (built on an unused Pololu extension platform " Pololu RP5/Rover 5 Expansion Plate RRC07B (Wide) Solid Black " ) to be easily coded and converted between the Raspberry Pi PICO RP2040 based and the ATMEGAZERO micro controllers, even possibly using a 16 channel PWM PCA9685 controller via I2C " Amazon.com: Onyehn 16 Channel PWM Servo Motor Driver PCA9685 IIC Module 12-Bit for Arduino Robot or Raspberry pi(Pack of 3pcs): Home Improvement " and possibly those DC Motor speed encoders " https://www.amazon.com/gp/product/B07TTMSDMR/ref=ppx_yo_dt_b_asin_title_o02_s02?ie=UTF8&psc=1 " or " https://www.amazon.com/gp/product/B081W4KMHC/ref=ppx_yo_dt_b_asin_title_o02_s05?ie=UTF8&psc=1 " (that I could never get working in a finished build)
powered by two dual 18650 battery packs " Amazon.com: Plastic 18650 Battery Storage Case 2 Slots x 3.7V for 2x18650 Batteries Holder Box Container with ON/Off Switch, Set of 5, by Ltvystore: Home Audio & Theater " and a 5 VDC buck convertor " Amazon.com: Valefod 3 Pack LM2596 DC to DC Voltage Regulator 4-40V to 1.5-35V Buck Converter with LED Display: Electronics " or " Amazon.com: SMAKN DC-DC Buck Step Down Converter Power Supply Voltage Volt Regulator Regulated 4.5-40V 12V to 5V 2A USB Charger Voltmeter Display: Home Audio & Theater " for power stability. I even bought a 18650 battery smart charger to test and condition my "over-rated/claimed" 18650 batteries " Universal Battery Charger Tester Anazlyer C3400 for Li-ion NiMH NiCd AA AAA C 18650 - - Amazon.com ".
During my Raspberry Pi PICO research on facebook and youtube, I saw an advertisement for the newly discounted ATMEGAZERO from "espinallabs.com" " ATMegaZero Online Store " (less 15%) and from their website "
WHAT'S AN ATMEGAZERO?The ATMegaZero is a microcontroller board based on the Atmel ATMega32U4 microchip, the same chip used in the Arduino Leonardo and Arduino Micro. The ATMegaZero gets its name from the fact that it is based around the 8-bit Microchip (nΓ©e Atmel) ATmega32U4 microcontroller & the form factor of the Raspberry Pi Zero.
The ATMegaZero comes with a built-in USB which makes the ATMegaZero recognizable as a mouse or keyboard.
Works out of the box with the Arduino IDE (Win/OSX/Linux)" I thought to myself, where did I hear that before.
Naturally, for the ATMEGAZERO I purchased all hardware/accessories available from site to learn from. This is a new form factor to me and I had no clue as to compatibility with what I had on hand. So I purchased three.
I would be faced with alot of challenges and changes with parts selection, layout, interconnection and programming. I even utilized "Thonny IDE" environment on my Windows 10 laptop to program in micropython for Micropython/Circuitpython based ATMegaZero-ESP32-S2 and the Raspberry Pi RP2040 boards. (maybe I'll try to program using that Raspberry Pi 400 that I bought that has Thonny on it).
I had also envisioned utilizing code examples from previous project builds (Osoyoo L298N to Arduino or Raspberry Pi) for WIFI/web access and motor control that utilized the ESP8266 and L298N/L9110S modules for Arduino, Raspberry Pi and Circuitpython robots that I had built. Why should I reinvent the wheel, when I can expand upon code that I already debugged in my environment(s).
Enough with research and reasons... let's get on with the build.
1. ATMegaZero Prep
2. Mecanum wheels/DC Motor/chassis
3. Top chassis Prep
4. Raspberry Pi PICO and 18650 Battery holders Prep
5. Interconnect wiring
6. Build Notes and Comments
As I positioned, drilled and assembled I added and removed components to address mounting issues with screws and standoffs. I even added the second L298N Motor controller instead of the two L9110S Motor Controllers that I originally wanted to use. This would allow independent motor control for the Mecanum wheels so side to side motion could be achieved.
During testing I found that a L9110S that I had installed was defective so it was removed. This was a time consuming troubleshooting event that was discovered during troubleshooting motor direction coding.
Also during testing and coding, I had difficulties getting PWM to work correctly; not enough PWM pins on the ATMegaZero available (this build required 4 PWM signals-two for each L298N for speed control for each motor) I also needed to swap pins to free up the 8 digital GPIO and 4 PWM signals required.
I even tried the 16 channel PWM module that used I2C communications because I had a previous project that used the servo ports to connect and drive each of the signals on the L9110S but then during that testing I had alot of motor studder/chatter as well as the failed L9110S module.
The Raspberry Pi PICO was a little or should I say, alot easier to wire up with its straight forward pinouts.
The aha moment !!!! was when I discovered that during an assembly revision, that I had forgotten to re-install the ground wires to both L298N modules "hidden beneath the I2C 16 channel PWM module. Once connected the ATMegaZero code and RPi PICO code began to work as expected and the motors turned.
I'll need to revisit the I2C connections, speed encoders, possibly HCSR04 Ultrasonic sensors for obstacle avoidance and other control software at another time. Maybe even some environmental or positional sensors or even video?
Still to be coded, is the ESP8266 Wifi web control interface for Arduino IDE as well as with Micropython so that I can control remotely.
I'll need to revisit the I2C connections, speed encoders, possibly HCSR04 Ultrasonic sensors for obstacle avoidance and other control software at another time. Maybe even some environmental or positional sensors or even video.
*****Note as of March 7, 2021 ...It hasn't been 24 hours and I need to make a code and wiring revision due to coding for usage of the ESP8266 ESP01S module and the four pins it uses to communicate with the ATMegaZero. Below is the excerpt from the ATMegaZero website:
" The ESP8266 used for the ATMegaZero is the ESP-01(S). We encourage to use the latest model which is the ESP-01S instead of the ESP-01. Both will work, but for best results please use the latest model.
π¨ Important read this first π¨The ATMegaZero uses software serial communication to talk to the ESP8266 module. The pins designated for Software Serial Communication for the ESP8266 module are D8 for ESP_RX and D9 for ESP_TX
. Also pin D5 is connected to ESP_RST
and D4 is connected to ESP_CH_PD
. Keep in mind these connections when using the ATMegaZero and the ESP8266 module. Try to avoid using pins D4 & D5
when using the ESP8266 to prevent reseting the ESP8266 during operation.
- The RST pin of the ESP8266 module is pulled up to 3.3V via 10k resistor, the same line goes to Atmega32U4 D5 pin (PC6/OC3A/~OC4A)
- The CH_PD pin of the ESP8266 module is pulled up to 3.3V via 10k resistor, the same line goes to Atmega32U4 D4 pin (PD4/ICP1/ADC8)
The two pins on the Atmega32U4 side are allways pulled up to 3.3V, the end user needs to take a note when using these two pins. The RST and CH_PD pins have 2 jumpers on the bottom side of the board, the jumpers are connected to GND, and if shorted out the pins will always be tied to GND.
If the end user does not plan to use the ESP8266 module on the board, they can remove resistor R14
and R15
from the board. R14 is the pull-up resistor for D5 pin
, R15 is the pull-up resistor for D4 pin
. "
My original code and wiring examples work if future WIFI connections are not required.
I also discovered that upon power-up, My Front Right motor on pin D13 PIN 29 "BIB IN4 on the top L298N " would spin clock-wise for 3 pulses; until the code initialized.
Comments