Pokitto Goes Racing!

This is my next HW/SW project :slight_smile:

I will update in this thread as the project progresses.

9 Likes

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 ?

2 Likes

I ordered another ultrasonic sensor (HC-SR04+), which operates with 3.3 V from AliExpress (less than 1 euro with postage costs:-)

3 Likes

CamJam Edukit #3 comes with DRV8833 Dual H-Bridge Motor Driver. Inputs are 3V- and 5V-compatible.

1 Like

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.

2 Likes

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…

3 Likes

If that happens, you get a new Pokitto. You are doing important work here!

4 Likes

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.


Video (sped up to reduce size)

The next step is to enable the range sensor so it can avoid obstacles. If I connect ENA and ENB to PWM signals I can moderate the speed. Right now it is running at 100%.

6 Likes

Great project! Thanks for sharing. Please keep us updated as you progress.

We want more of these :slight_smile:

4 Likes

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?

2 Likes

Two questions about PWM:

  1. Is there hw support for it?
  2. If not, why we could not use any GPIO pin for sw PWM? Why there need to be dedicated pins?
1 Like

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

Hi Hanski,

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

  • Roam about avoiding obstacles
  • Follow a pre-programmed course, because we all wanted a Big Trak in 1979
  • Roam about and build a map of the area the car is released in
  • Negotiate a course where success comes from following a precise path
  • Run under remote control and send back sensor readings
  • Build up a number of vehicles, and work through some of the issues of self-driving cars
  • Document a low-cost hardware and software design so we can trade notes

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.

2 Likes

Hi Jonne,

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 :slight_smile:

3 Likes

Btw theres a SoftPWM library for mbed. So you can use any pin to PWM. Search with “softpwm mbed”

https://os.mbed.com/users/komaida424/code/SoftPWM/

2 Likes