In my last article, I wrote about using an MD04 motor driver for my motors. In the example, I used an Arduino Uno to test the motor drivers and made the code work. I want to use the Teensy 4.1 in my robot because of the board’s multiple serial connections and its higher speed. The Teensy runs on 3.3 Volt instead of the 5V Arduino uses. I could not find the voltage level for the I2C wiring in the documentation. According to the manual, the serial communication and the analog input use 5V, so I assume the SCL and SDA are the same.
To overcome the voltage differences, I used a level converter. A level converter is a small board with a low and a high-level side. A MOSFET and other components on this board compensate for the voltage difference between the two sides. Connect the low-level side (LV) to the Teensy and the high-level side (HV) to the MD03. The image below shows how I wired the Teensy, the motor driver, and the level converter.
I used a USB breakout board to provide the 5 volts to the high side of the level converter. The low side of the level converter gets its power from the Teensy. I used two pull-up resistors on both sides of the level converter (10K). Technical, the connections remained the same. We used the standard I2C pins, so the software stayed the same. You can use the code example from the previous article.