This is my next HW/SW project
I will update in this thread as the project progresses.
How are you going to solve the 3.3-5V issue?
Excellent. I’m waiting for example code for this.
Which H-bridge will you use ?
I ordered another ultrasonic sensor (HC-SR04+), which operates with 3.3 V from AliExpress (less than 1 euro with postage costs:-)
CamJam Edukit #3 comes with DRV8833 Dual H-Bridge Motor Driver. Inputs are 3V- and 5V-compatible.
Do you know how much current can you absorb from 3.3V connector on PEX header?
No, but I guess it is enough for an ultrasonic sensor. The motors get their current from a separate 6 V battery.
I have now managed to implement Pin-module for MicroPython which uses the same methods in Mbed API as the C+±implementation. Next I am trying to test if the code really works with the motors(!). My only real fear is that I will burn pins in my Pokitto or worse…
If that happens, you get a new Pokitto. You are doing important work here!
I am reading a lot of BBC MicroBit HW project instructions because I believe it has somewhat similiar HW. (3.3v design).
I took an existing “smart car” platform that I was running from a Freedom KL25Z controller and swapped in a Pokitto. I’m using a popular motor driver board based on the ST L298. This motor driver has been working fine with 3.3v input logic signals. I have a pair of Li-Ion 18650 cells driving the DC motors. Connections to the motor driver board are
ENA <-> EXT0
ENB <-> EXT1
IN1 <-> EXT2
IN2 <-> EXT3
IN3 <-> EXT4
IN4 <-> EXT5
GND <-> GND
Source code is here
Press A to execute the driving script, press A again to stop.
Great project! Thanks for sharing. Please keep us updated as you progress.
We want more of these
What is that ultrasonic sensor?
Great work! You can use EXT0 and audio out for two PWMs. Also @RichardAmes do you have a twitter handle?
Two questions about PWM:
EXT0 and audio out can both do hardware PWM using normal mbed methods.
Any GPIO pin can be used for software PWM if high frequencies are not needed
I think that’s the same ultrasonic sensor that you are using. It’s labeled HC-SRO4. It may look unfamiliar because I have it soldered to some protoboard. I’ve used these before with Arduino boards, and for me the output was quite noisy, so for this build I’m planning on replacing it with a time-of-flight laser sensor mounted on a servo.
More notes: On this particular car, the motors are (by luck) well matched and the car tracks fairly straight, but on others it can be hard to get the vehicle to run straight. I have sensors to read the slotted discs that attach to the motor output shafts. To use these we could tie the sensor output to an interrupt (research needed). Then we could see how the motors respond to a given PWM on the EN input. I can imagine using this for periodic calibration to bias one motor vs. the other, or one could run feedback all the time so that commands to the motors are for a closed-loop rotation rate.
These “arduino smart car” platforms have been floating around for a number of years. I got in late in the game, which is nice because all the parts are very affordable. I suspect the designs are derived from a common source, like the Parallax robot kits, but I don’t know what the ur-smart-car might be. I haven’t come across an information resource that covers the platform as a whole. It seems like it would be quite useful, but I also suspect folks keep moving on to new projects.
Here are some goals I can imagine for this platform
Even more notes: I mounted the Pokitto to hang off the edge so I can access the back buttons to reprogram it while it is in place. It might be convenient to wire up a dedicated connector and set up some of those lego slotted shafts on the chassis so we can plug in the Pokitto and snap it in place.
Thanks for the tips, as always! I’ll try this out next. My twitter handle is RichardAmes, but I rarely use it lately.
That’s a lot of good info. Very interesting! My focus is first to get the car moving as I am not very experienced in electronics. I also target to teach programming and AI algorithms to my kids with this project. I am planning to make a Lego chassis and connect Pokitto to that. I also have noticed a need of separate PEX connector socket to easily attach and detach Pokitto from the car.
Ps. Talking about interesting projects:
It would be nice to attach Pokitto to that
Btw theres a SoftPWM library for mbed. So you can use any pin to PWM. Search with “softpwm mbed”