Zoomx's postbag

Tell us about the cool things you've recently got
User avatar
zoomx
Posts: 541
Joined: Mon Apr 27, 2015 2:28 pm
Location: Mt.Etna, Italy

Zoomx's postbag

Post by zoomx » Thu Jun 15, 2017 9:48 am

I got two cheap line following car kit, they are about 5 euro.
This one, D2-1 (but has others names sometimes or no name at all)Image
and this one D2-5
Image
The schematic is quite the same
Image
Mounting the electorinic components it’s easy but the motor mount of the firts one take much more time of the latter so IMHO it's better to get the D2-5.
After mounting them I removed the LM393 and connected some wires from a Maple mini to the chip socket. I used pins PA8 and 9 connected to pin 1 and 7 in the socket plus ground.
This way the maple mini is able to turn on and off the motor so these little kits can be a cheap robotic platform.

I tried also PWM but failed: the motors seems to move at the same velocity.

Code: Select all

/*
  STM32_robot02
  Test sketch for cheap robot kits like D2-1 and D2-5
  Added pwm
  https://developer.mbed.org/media/uploads/hudakz/maplemini_pinout01.png
  http://wiki.stm32duino.com/images/a/ae/Bluepillpinout.gif
*/

#define motor1 PA8  // D7 or 27 on Maple Mini
#define motor2 PA9  // D8 or 26 on Maple Mini
/*
   motor1  | U   |
           |     | motor2
           |     |
     GND   |     |
           ------
*/

void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
  Serial2.begin(115200);
  Serial.println("Hello world this is Serial");
  Serial1.println("Hello world this is Serial1");
  Serial2.println("Hello world this is Serial2");
  pinMode(motor1, OUTPUT);
  pinMode(motor2, OUTPUT);
}

void loop() {
  for (int i = 0; i <= 65472; i += 1023) {
    pwmWrite(motor1, i);
    pwmWrite(motor2, 65472 - i);
    Serial.println(i);
    Serial1.println(i);
    Serial2.println(i);
    delay(250);
  }
  delay(10);
  for (int i = 0; i <= 65472; i += 1023) {
    pwmWrite(motor2, i);
    pwmWrite(motor1, 65472 - i);
    Serial.println(i);
    Serial1.println(i);
    Serial2.println(i);
    delay(100);
  }
  delay(10);
}
but I never used PWM on STM32 so maybe I made a mistake. And I am not able in ASCII art.

User avatar
RogerClark
Posts: 7447
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Zoomx's postbag

Post by RogerClark » Thu Jun 15, 2017 10:28 am

As a coincidence I just got a larger 2 wheeled "robot",

Image

but there are no instructions with it. So I'm having to look at various YouTube videos and blogs etc even to do the manual construction

It comes with a Arduino Uno, but it was cheaper to buy a whole it including a Uno than to buy the parts e.g. motors, and H bridge etc, separately.

It has encoder discs for the wheels but does not have any optical sensors. But I think I may have some in one of my boxes of components.

Looks like the H Bridge is a STM L298N, ( http://pdf.datasheetcatalog.com/datashe ... s/1773.pdf ), and as far as I can tell it can accept 3.3V PWM

So, its going to take a while to get it working with a BluePill

User avatar
zoomx
Posts: 541
Joined: Mon Apr 27, 2015 2:28 pm
Location: Mt.Etna, Italy

Re: Zoomx's postbag

Post by zoomx » Thu Jun 15, 2017 11:09 am

I have this one, bought may years ago, only mechanical parts because I have already the others electronic parts. Motors and gears are mounted and so the ultrasonic sensor but only up to one servo, not the pan tilt mount. But I see on the kit that there is only one servo.
There are many photos in the net about this kit mounted.
For example herehttps://www.aliexpress.com/item/Smart-R ... 86957.htmlImage

It look at me from the box where it get dust.

User avatar
RogerClark
Posts: 7447
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Zoomx's postbag

Post by RogerClark » Thu Jun 15, 2017 9:28 pm

Thanks. Mine looks very similar.

I looked at those pictures on aliexpress, and it helped with the servo mounting for the ultrasonic range detector.

One crazy thing is, despite there being loads of holes in the base-plate, none of the holes line up with the H-Bridge module, so I will need to file 2 holes, even to be able fix it in 2 corners.

I wonder if there is a PDF or SVG or DXF file of the base plate, because I have a 100W laser cutter ( I did a major upgrade on a cheap 40W laser cutter from China), so I could cut a new base plate from plywood or acrylic

User avatar
zoomx
Posts: 541
Joined: Mon Apr 27, 2015 2:28 pm
Location: Mt.Etna, Italy

Re: Zoomx's postbag

Post by zoomx » Fri Jun 16, 2017 6:32 am

The ultrasonic board is mounted on the gears side, the little gear is on the back of the car.
The holes are for direct mounting of a servo, then you mount the ultrasonic board over the servo. I have to take some photos, anyway.

Meantime I discovered a silly silly silly mistake in my sketch: I used some serial pins for PWM signal at the same time! :lol:

User avatar
RogerClark
Posts: 7447
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Zoomx's postbag

Post by RogerClark » Fri Jun 16, 2017 7:29 am

zoomx wrote:
Meantime I discovered a silly silly silly mistake in my sketch: I used some serial pins for PWM signal at the same time! :lol:

:lol:

Easily done.

User avatar
zoomx
Posts: 541
Joined: Mon Apr 27, 2015 2:28 pm
Location: Mt.Etna, Italy

Re: Zoomx's postbag

Post by zoomx » Sat Jun 17, 2017 8:47 am

Changed pins to PA6 and PA7 and pin definition from OUTPUT to PWM. Now it works but... in a strange way.

If I write a PWM value from 65472 to zero the wheel slowly stops.
If I write a PWM value from 0 to 65472 it doesn't start until it reach the higher value.

User avatar
zoomx
Posts: 541
Joined: Mon Apr 27, 2015 2:28 pm
Location: Mt.Etna, Italy

Re: Zoomx's postbag

Post by zoomx » Sat Jun 17, 2017 9:41 am

Image

This is how ultrasonic sensor is mounted on my car kit.

I bought one VL53L0X sensor, it is smaller
Image
but I don't know if the small servo will work at 3V.

User avatar
zoomx
Posts: 541
Joined: Mon Apr 27, 2015 2:28 pm
Location: Mt.Etna, Italy

Re: Zoomx's postbag

Post by zoomx » Sat Jun 17, 2017 9:54 am

After playing with some mouse optical sensors I bought this one, an ADNS3080 board
Image
that is used as a flow sensor, just like a mouse, in vehicles, usually quadricopters. My PARROT Bebop 2 has this sensor but the new version that use a webcam CMOS camera.
The ADNS3080 is only 30x30 pixel but has an advantage: it doesn't have any bayer filter. This mean that maybe is more sensitive in IR and UV than CMOS cameras without IR filter. I wish to check this, removing the lens with the help of some UV band filters that I have at work.

User avatar
RogerClark
Posts: 7447
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Zoomx's postbag

Post by RogerClark » Sat Jun 17, 2017 10:58 am

Very interesting

I had considered modifying a mouse to see if I could re-purpose its camera. This looks better. I will buy one.

I wonder what the focal distance is.

Would it work on robot car ? Or is the focal distance too long

Post Reply