User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

raspcatbot

Sun Mar 15, 2020 2:49 pm

Back in 2017 I played with a 20$ plastic caterpillar robot platform.

2.5 years ago I bought T101 aluminum alloy platform (wheels plastic).
I was not able to assemble the robot based on Chinese only instructions (even using Google translate).
1 year ago I bought 2nd T101 for 24$ from different vendor on aliexpress.com -- got exactly same instructions again :-(
https://www.aliexpress.com/item/32813434124.html

Nothing happened until yesterday, when I looked on things I bought on aliexpress.com over the years.
I found a similar Doit brand robot (wheels are built from metal as well), and that had a git repo, and that had videos:
https://github.com/SmartArduino/SZDOITW ... deo--Video
Especially the "Installation" video (youku seems to be Chinese youtube) enabled me to assemble my two T101 robots in 2h!
As the photo shows, I plan to control that robot with Raspberry Pi3A+ this time
(drive autonomously, control via Wifi, high framerate video processing, probably video streaming, ...):
Image
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Sun Mar 15, 2020 3:06 pm

Back in 2017, before working a lot with Raspberry cameras (high framerate capturing with up to 665fps/1007fps with v1/v2 camera, live video processing, ...) the plastic robot had Arduino Due for motor control and utilizing Arduino PID controller library, and a Pi Zero[W] for camera control and video processing:
Image

Two things from 2017 I will reuse with new raspcatbot platform:

1) Raspberry camera high above the platform, because that allows to see space in front of robot from 4cm (the present) up to more than 1m (future) for controlling fast moving autonomous line following based on more than "present" data:
Image


2) I did play with many motor types and motor platforms. I ended up with caterpillar platforms because they are easy to control, but more because you can do really crazy stuff with them! The fastest kind of U-turn is not by stopping one of the motors, but instead to keep it running full speed and just reverse its direction (hard for the mechanics, but works reliably). The robot did slightly more than full U-turn at speed of 2.4m/s(8.6km/h) in less than 0.5s!!
https://forum.arduino.cc/index.php?topi ... msg3236016
Image


Plan is to do Raspberry only solution this time, motor control with Raspberry is easy.
The need for an Arduino is gone completely because I made the powerful Arduino PID library usable on Raspbian as well:
https://forum.arduino.cc/index.php?topic=649071.0
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
DougieLawson
Posts: 38553
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: raspcatbot

Sun Mar 15, 2020 3:14 pm

You should have a look at https://homofaciens.de/index_ge.htm he's been building Raspberry Pi based robots for a long time (in amongst the other stuff he does with 3D printers). He's got some internet controlled robots (that I can drive round his workshop).
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

I'll do your homework for you for a suitable fee.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Sun Mar 15, 2020 3:44 pm

For the new T101 platform there were two motor options, 9V/150rpm with encoder, and 12V/330rpm without.
Since I am interested in speed, I selected the 330rpm version.
Wheel diameter is slightly less (60mm) than the 2017 platform diameter (65mm).
At 12V laser tachometer measured 317rpm for the T101.
Even with 330rpm speed is not comparable with the 2.4m/s of old platform:
π*0.060*330/60 = 1.04m/s = 3.7km/h

So why did I buy this T101 at all when interested in high speed?
I did find identical form factor 12V/1500rpm gear motors back in 2017, and ordered them on dx.com.

One of the T101 robots in image of initial posting of this thread has original 330rmp motors, the other has the 1500rpm motors.
I had to learn again that breadboard cables are fine to drive the 330rpm motor with low current.
But for the 1500rpm motor current gets really high and thick cables are needed.

The first measurement with 1500rpm motor, free running and at 12V from constant current power supply was a bit disappointing -- only 970rpm, not even close to 1500rpm I was interested in. But then I tried a little bit of overvoltage, and with 15V I measured 1412rpm.
This gives new nice speed:
π*0.060*1412/60 = 4.4m/s or 16km/h (!)
T101_1500rpm_motor.png.jpg
T101_1500rpm_motor.png.jpg (40.67 KiB) Viewed 2058 times

After motor runs a few minutes it gets more than warm, but not really hot. Main application for this robot platform will be fast line following, and there a complete run will typically take less than a minute. So this should not be a problem.

To answer question on why I was not happy with the 2.4m/s of my 2017 robot platform?
I want to be able to beat "Thunderstorm" robot, that suck itself to ground and finished with 3.10m/s on average!
https://www.youtube.com/watch?v=cvkveIf2o9g
Image


P.S:
Caterpillar robot can do back wheelie ...
Image

... as a real tank can -- that is one more reason I like the full speed U-turns that look so easy:
Image
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Mon Mar 16, 2020 11:58 am

Two updates:

1) power
I have two 1000mAh 25C 3S lipos, but they do provide 11.1V (or 12.6V fully loaded) only.
I do have two 600mAh 25C 1S lipos as well, they provide 3.7V (4.2V fully loaded).
Therefore I did a quick test and put 16.8V from constant power supply to one 12V/1500rpm gear motor of the robot:
T101_1500rpm_motor.target.jpg
T101_1500rpm_motor.target.jpg (51.03 KiB) Viewed 1983 times

Even running for minutes the motor is not really hot. I was happy with the newly measured 1700rpm(!) for 16.8V.
This gives nice free running speed (higher than the 5m/s or 18km/h I was hoping for):
π*0.060*1700/60 = 5.34m/s or 19.2km/h (!)

1000mAh 25C lipo can deliver 25W, sufficient for one motor:
15*1.301=19.515
16.8*1.146=19.2528

I have another 900mAh 25C 3S lipo, that can deliver 22.5W.
At 12.6V it can provide 1.8A.
With stepdown converter to 5V this will hopefully suffice to power the Pi3A+ (with camera and Wifi).


I will use the other T101 with 330rpm gear motors for initial development.
With 12V the measured current was 437mA, so 5.244W.
Perhaps a single 1000mAh 25C 3S lipo will be sufficient for both motors and the Pi3A+ in that case.

2. emergency stop
In order to deal with high speeds inhouse, an effective emergency stop is needed.
You have seen the solution to minimize space for stopping in full U-turn video before.
Here is same U-turn at 2.1m/s, captured with v1 camera at 90fps from above, played ad 25fps, 3.6 times slower than real:
https://forum.arduino.cc/index.php?topi ... msg3221028
Image

Now think that instead of doing a U-turn the motors keep running in opposite direction.
Then the robot will run circles only.
And as you can see it does need minimal space only (0.4m after triggering).
Then both motor speeds can be reduced to 0, while keeping rotation at same location.


I plan to keep a Wifi connection to the Pi3A+ even when the robot runs autonomously.
There will be a 10Hz heartbeat signal to the Pi3A+ over Wifi.
Whenever that heartbeat is not received (by Wifi loss or intentionally), the robot will do emergency stop.
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

CharlyDelta
Posts: 160
Joined: Thu Jul 18, 2013 4:04 am
Location: Montreal

Re: raspcatbot

Mon Mar 16, 2020 1:27 pm

I will follow this tread with interest because, having completed the NIDcornifleur v.6 project, I was short of work. So I bought a Devastator tank, which I'm going to operate by wifi, that I want to equip with a pan-tilt camera. The goal is to inspect, in my place, the sanitary space under my house that is very difficult to access.

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Mon Mar 16, 2020 9:44 pm

Reality check for
  1. 4S lipo powering caterpillar free running 1500rpm gear motor
  2. 3S lipo + stepdown converter powering Pi3A+ with camera and active Wifi

4S lipo powering caterpillar robot free running 1500rpm gear motor
3S lipo and 1S lipo in series, as discussed, give 16.77V:
Image

Slightly less rpm than measured with 16.8V before, but 1662rpm is speed 5.22m/s or 18.8km/h(!):
Image


3S lipo + stepdown converter powering Pi3A+ with camera and active Wifi
900mAh 25C 1S lipo with stepdown converter successfully drives Pi3A+ (with wireless keyboard USB dongle, camera recording and Wifi traffic):
Image


From last posting we know that 1.146A are needed for driving the gear motor at 16.8V.
The TB6612FNG motor driver I want to use can deal with 1.2A on average.
Will have to see whether nominal max voltage of 15V is a show stopper for 4S lipo:
https://www.aliexpress.com/item/4000793977155.html
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Tue Mar 17, 2020 8:53 am

Plan change, I will not use TB6612FNG motor driver for controlling raspcatbot.
Not because of the 15V limit, but because I don't know how to connect cables that can deal with more than 1A and breadboard.

I remembered what happened last time back in 2017 when pushing amps through thin breadboard cables -- they burned.
And as you can see here (mini-)breadboard does not like amps either:
https://forum.arduino.cc/index.php?topi ... msg3340529
Image


I already know how do control many volt+apms from Raspberry Pi securely:
All cables with high voltage and/or high amps have to be thick, with the needed connectors.

I used IRF520 mosfet driver before, it can handle 0-24V and 0-5A. Only for longer use of >1A a heatsink is needed.
Last year I used two of those moduls in series a lot to control diy 50W 5000lm 38V/1.5A high speed flash from Raspberry for global external shutter images and videos with Raspberry v1 camera. Here is comparison to commercial much more expensive flash:
https://github.com/Hermann-SW/Raspberry ... ed-flashes

Here you can see the highspeed flash and that I have enough such modules to drive the caterpillar robot.
One mosfet is for one motor in one direction (GND/VCC/SIG pins), a second is needed for the other direction.
So in total 4 moduls are all that is needed, and cheap modules being capable of 24V/5A is far more than what is needed for the 1500rpm gear motors:
Image
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Wed Mar 18, 2020 3:30 pm

Before final assembly of raspcatbot robot:

Yesterday free running test did even show 1850rpm on laser tachometer, for (over)powering 12V/1500rpm gear motors with 16.77V (from 3S+1S lipos for each motor). That is 5.8m/s or 20.9km/h.

I switched to the other T101 platform because I did mount the middle pieces holding the chassis together one screw hole higher than on the other. I took the motors from this other robot (experimental omni wheel used for turning was not a good idea):
https://stamm-wilbrandt.de/en/forum/IMG ... 232926.jpg
I added four distance screws from another robot platform, did Dremel 4 holes into flat Lego plate that I did cut to the dimensions needed and screwed the plate onto the T101. I did solder the connector for the second motor 3S+1S lipo, now all parts are available:
Image
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Thu Mar 19, 2020 8:37 pm

  • bad experiment with 2 IRF520 mosfets
  • damage analysis
  • Pi3A+ controlled PWM motor control via L298N motor driver
  • summary/next steps
bad experiment with 2 IRF520 mosfets
I did what I explained before, connected two 16V mosfet outputs (one with switched polarity) together in screw terminal.
I did set 1st mosfet SIG to 1 and 2nd mosfet SIG to 0.
Then I measured voltage at screw terminal as 16.7V.
Next I did set 1st mosfet SIG to 0 and 2nd mosfet SIG to 1.
Before I was able to measure, bad smelling of mosfets happened.
I did set 2nd mosfet SIG to 0 and separated Pi3A+ and mosfets.
Image


damage analysis
I had used GPIO18 and GPIO17, and tested then whether they work -- they did not.
I tested whether GPIO27 works, and it did not :-(
Then I did shutdown the PI3A+, waited a moment and powered it up.
Via ssh I was able to verify that GPIO27 worked again.
BUT GPIO18 and GPIO17 are dead permanently.
Next I tested the mosfet modules.
One was fine, the other broken (it always showed full voltage on output, regardless of SIG setting).
GPIO17 is really dead, 0V always, but GPIO18 shows 0.02V/0.06V for setting low/high.

What I missed to add were diodes that would have avoided output voltage of one mosfet module to go back to the other module.

Pi3A+ controlled PWM motor control via L298N motor driver
I looked for other motor drivers I have that allow for 16.8V and more than 1A.
Luckily I found three L298N modules, that can do up to 35V and 2A.
I had to remove all 3 jumpers of L298N module:
The 1st because voltage was above 12V.
The 2nd because I wanted to do PWM to drive out1/out2.
The 3rd because I will not use out3/out4 -- the other caterpillar motor will get its own L298N and 4S lipo.
Because jumper1 was removed, I had to power the 5V line of the module with 5V from Pi3A+.
GND from Pi3A+ and 4S lipo are connected to GND of L298N.
16.7V from 4S lipo is connected to input labeled "12V" of L298N.

I used JuiceSSH on my smartphone to control the motor with pigpio pigs command (robot Wifi remote control).
"pigs p 23 64" did set PWM signal to 25%, directions were selected by GPIO27 and GPIO22.
https://stamm-wilbrandt.de/en/forum/Scr ... iceSSH.jpg

This is photo of Pi3A+ controlled motor running at full speed (255).
I tested both motors connected to L298N, and voltage of 4S lipo was a bit reduced to 16.49V.
Both times measured speed was slightly above 1600rpm, 5m/s or 18km/h under full speed and direction control of Pi3A+ !!
Image


summary/next steps
Lost GPIO18 and GPIO17 of Pi3A+ permanently, but besides that all else seems to work (I verified that camera works).
L298N can drive the 12V/1500rpm with >16V and achieve target speed of 5m/s even when not fully loaded.
L298N module has the screw terminals needed to connect thick cables because of amps.
Now its time to assemble the two 4S lipos with L298Ns and the Pi3A+ with its own lipo onto the robot ...


P.S:
I did cover the 4 screws that fixate flat Lego plate on robot with flat 2x2 Lego pieces.
I had to dremel some stuff of their underside away in order to fully cover the metallic screws.
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Fri Mar 20, 2020 5:08 pm

I am just assembling the robot.
For initial tests I wanted to have a Wifi joystick, that can send the heartbeat to the robot as well.
And I wanted it to have a small display, for showing joystick as well as probably robot status data.

Since PiZeroW misses ADC for joystick, my ESP32 with OLED came to my mind.
Initial (Arduino) sketch just displays joystick data, no Wireless stuff yet -- but it works, maybe useful for other people/projects as well:
"Wifi joystick with display" (the 3rd number gets 1 if joystick is pressed --> raspcatbot emergency stop)
https://esp32.com/viewtopic.php?f=19&t=14803
Image
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Fri Mar 20, 2020 8:17 pm

In the middle of assembly, time for a 16MP photo of the power layer of robot.
Location of the 4S lipos and L298N motor controllers is point reflection at center of flat Lego plate.
The 1S lipo lies on top of 3S lipo, and they are bricked with Lego pieces.
L298Ns, screw terminals and step-down converter are screwed on flat Lego plate (M3 screws through 2.8mm ⌀ dremeled holes).
Only power on/of switch is superglued onto a flat 4x2 Lego piece.

Next layer will carry v1 M12 lense NoIR camera with IR-Led and stepper tilt motor on "bridge", as well as Pi3A+:
Image
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Fri Mar 20, 2020 11:01 pm

Assembly complete for now with all cables connected, inclusive tilt camera SG90 servo motor.
I powered the Pi, and was able to capture an image with the camera in ssh session.
More functional tests tomorrow -- raspcatbot now is a 1.173kg whopper:
Image
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Sat Mar 21, 2020 12:20 pm

Functional testing (1)

I temporarily disconnected the camera cable and SG90 servo cable for motor only testing.
raspcatbot was jacked up for easy testing, turning continous track can be done at full speeds that way.
In case changing motor direction while motor is running, the robot does a move -- I never tried that full speed jacked.

In 16MP photo from back of raspcatbot you see both continuous tracks moving backward with 500rpm, more below:
Image


I learned that the motors have sweet turning direction CCWSE (Counter ClockWise from Shaft End).
These are the maximal (PRM=255) turning speeds determined for left and right motors (determined with laser tachometer):

Code: Select all

right fwd 1430 rwd 1560  15.85V
left  fwd 1640 rwd 1560  16.24V
Because of the gear motor mounting it is not possible to have both motors sweet direction for forward movement.

There is a bigger difference at lower voltages between left and right motor.
This is the sequence for pigpio pigs commands to turn both motors at same speed of 500rpm in robot reverse direction:

Code: Select all

[email protected]:~ $ sudo pigpiod
[email protected]:~ $ pigs m 22 w m 27 w m 9 w m 25 w
[email protected]:~ $ pigs w 22 1 w 27 0 w 9 1 w 25 0
[email protected]:~ $ pigs p 23 84 p 10 129
[email protected]:~ $ pigs p 23 0 p 10 0
[email protected]:~ $ 
PWM values of 84 and 129 are quite different to achieve the same motor rotation speed of 500rpm.

Once during the motor tests connection to the Pi3A+ got lost, ping did not work.
Of course that happend with one motor running at full speed.
I had to use raspcatbot's power off switch to end that.
This is an important reminder that any further work with robot not jacked requires heartbeat based emergency stop.


The Pi is powered from 3S 25C 900mAh lipo with stepdown converter.
I just noticed that the Pi3A+ was not reachable, and reason was that 3S lipo dropped to 3.5V.
I don't know the time of operation, but it is between 1h and 2h.
Just charging that lipo in place on robot.
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Sat Mar 21, 2020 8:12 pm

Functional testing (2)
Next tilt camera was tested.
While I know to be always careful with 16V and >1A, doing wrong with 5V can be bad as well.
I did accidently connect Pi3A+ GND/5V pins to SG90 servo VCC/GND pins.
Bad smell, and the stepper motor did not work anymore after cabling correctly.
After swapping with a new SG90 testing could start.
I did install uv4l on the Pi3A+ in order to see live camera video on laptop browser.
Nasty was that installation instruction was not correct:
(and that still no Pi4B instructions were added, "server-option = --use-ssl=no" needed for Pi4B in /etc/uv4l/uv4l-raspicam.conf)
http://www.linux-projects.org/uv4l/installation/
Apart from the driver for the Raspberry Pi Camera Board, the following Streaming Server front-end and drivers can be optionally installed:
This is not optional, only with this installation uv4l does work in the browser.

Here you can see live camera video on laptop HDMI monitor, and ssh session of Pi3A+ that does some stepper demo:
uv4l.servo.jpg
uv4l.servo.jpg (111.08 KiB) Viewed 1483 times

This is recorded smartphone video of the scene while demo was done:
https://www.youtube.com/watch?v=OttsPsT ... e=youtu.be
uv4l.servo.yt.jpg
uv4l.servo.yt.jpg (51.55 KiB) Viewed 1483 times

P.S:
I had problems charging the 3S lipo needed for powering the Pi3A+, did temporarily use official power supply.
While replacing the tilt servo motor I noticed that the IR-led was really hot -- I removed that for now.
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Sun Mar 22, 2020 9:43 am

Functional testing (3)
Bad news first, I wondered why charging the 3S lipo powering the Pi3A+ always stopped at 8.39V and did not reach 12.6V. I learned that I lost a cell of the three cells inside. Anyway 2S lipo can power Pi3A+ as well.

Next I did functional test of servo tilt camera with motors and got a real surprise.
While the position of the stepper was not changed, turning the motors badly affects camera tilt position.
When motors are stopped, tilt position goes back to target position (youtube video for audio):
https://www.youtube.com/watch?v=4uNWPFy ... e=youtu.be
Image

I read that while stepper motors draw current regardless whether they move or not, current drawn by servo motors is proportional to speed. So stepper will draw no current when having reached target position (which will be always for raspcatbot after initial calibration).
I read as well that a servo should not be powered from Arduino 5V pin directly, but from a different power source. The video just taken seems to be nice proof of that advice not powering servo from 5V power pin of a Pi. I connected the servo VCC to 5V of one of the L298Ns, which is connected to one of the Pi 5V pins.
After disconnecting cable from servo VCC camera keeps in position when motors run.
Disconnecting servo VCC after initial calibration is no option, since the servo should keep camera tilt position even when forces due to high speed robot turns will try to change it during robot run.

Will try to connect servo VCC to output of step-down converter, which is used to power the Pi.
Will connect cables with female USB connector for plugging official power supply there as well.
That will allow for easy switching between powering Pi+servo from 2S lipo or from power supply.
Powering from power supply is sufficient for all local (jacked up) testing.
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Sun Mar 22, 2020 12:51 pm

Functional testing (4)
I did what I planned for. Results with powering the servo directly from step-down converter were better, but tilt camera angle still shakes in ±10° range.

Then I powered the servo from a separate 500mAh lipo pack, no C rating. Since that is good enough to power Eachine E52 quadcopter, it should be good enough to power a single servo.
(I once reverse engineered E52 Wifi protocol, plan was to let PiZero "riding" the drone to capture video stream and fly E52 autonomously
https://github.com/Hermann-SW/wireless- ... -e52-drone )

I superglued the E52 lipo box with 4 drops onto a 6x2 flat Lego piece and mounted it on left front of robot. Now servo is not affected by running motors, keeps stable. In the middle I executed a pigs command moving the servo to different position. Works like a charme. So raspcatbot now carries three 3S and three 1S lipos in total:
https://www.youtube.com/watch?v=myM8JK7 ... e=youtu.be
Image

I will keep the new connector (without the orange cable used to power servo previously). Allows to easily power Pi3A+ from either 3S lipo, or from Raspberry mains adapter:
Image
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

RpiName
Posts: 717
Joined: Sat Jul 06, 2013 3:14 am

Re: raspcatbot

Sun Mar 22, 2020 4:58 pm

HermannSW wrote:
Sat Mar 21, 2020 8:12 pm
Apart from the driver for the Raspberry Pi Camera Board, the following Streaming Server front-end and drivers can be optionally installed:
This is not optional, only with this installation uv4l does work in the browser.
"optional" means that, with or without the server module installed, UV4L registers the device in the system as a V4L2-compliant node i.e. /dev/video<x>, which makes it accessible from any third-party V4L2 application (e.g. another web server).

User avatar
neilgl
Posts: 1912
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: raspcatbot

Sun Mar 22, 2020 5:38 pm

It is looking good!

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Sun Mar 22, 2020 8:20 pm

RpiName wrote:
Sun Mar 22, 2020 4:58 pm
"optional" means that, with or without the server module installed, UV4L registers the device in the system as a V4L2-compliant node i.e. /dev/video<x>, which makes it accessible from any third-party V4L2 application (e.g. another web server).
Thanks for the clarification.

I did weigh the robot again after the last changes and addition of separate lipo for camera tilt servo, now weight is 1227g.

I had a call with my older son, and he mentioned that powering the two caterpillar motors L298Ns from separate 4S lipos will lead to additional control need due to different voltages. While later the autonomous control algorithm could deal with that, I agree that same voltage for both L298Ns is desireable for upcoming Wifi joystick control. I will achieve that by adding two thick cables between both L298N VCCs and GNDs terminals. The two 4S 25C 1000/600mAh lipos in parallel will then act as a single 4S 50C 1000/600mAh lipo.

This comes right in time since Wifi control will be available soon -- simple joystick coordinate TCP transmission to the Pi3A+ works already (with netcat on the Pi side). I will have to use "select()" with timeout on the Pi side to detect heartbeat miss and trigger emergency stop. Initially emergency stop will just set both motor speeds to 0, later it will be replaced by the "high speed small area" emergency stop described before:
https://esp32.com/viewtopic.php?f=19&t= ... 220#p57220
ESP32toPi.tcp.yt.jpg
ESP32toPi.tcp.yt.jpg (56.82 KiB) Viewed 1276 times
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Tue Mar 24, 2020 8:50 am

Wifi joystick remote controlling raspcatbot's motors the first time worked, heartbeat timeout code not yet (likely that OLED draw() function on the ESP32 consumes too much time, although timeout was 1s long). More details on ESP32 Arduino sketch and Pi3A+ code sofar:
https://esp32.com/viewtopic.php?f=19&t= ... 291#p57291

https://www.youtube.com/watch?v=UiOidcK ... e=youtu.be
Image
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Tue Mar 24, 2020 9:22 pm

After quite some debugging I found the reason why "select()" timeout code on the Pi did not work yesterday.
The man page states the reason -- I initialized timeout struct once and then reused it for the select() calls, not good:

Code: Select all

[email protected]:~/raspcatbot $ man select | sed -n "/Consider/,/returns/p"
       a loop without reinitializing it.  Consider  timeout  to  be  undefined
       after select() returns.
[email protected]:~/raspcatbot $ 
The good thing in that debugging work was, that I did get rid of "netcat" use, found a very simple C TCP server code:
http://www.cs.rpi.edu/~moorthy/Courses/ ... ocket.html
I took less than 40 of the 47 lines from server.c, and now dead-man_button.c is complete and does networking, heartbeat timeout handling as well as PWM and GPIO direction control of both caterpillar robots. The code is work in progress, I ended in using a 0.4s timeout for both select() calls (0.3s did emergency stop without me triggering it via dead-man button).

I did first real mini drive on laptop top, not a good idea. Robot did go a bit fore, a bit back, and then crashed into lamp left of laptop. The Lego pieces bridge carrying the camera did break by that -- easy to repair.

Then I did select a bigger space for the robot. The code does set same PWM signal (either fore or back) to both gear motors. But the continuous tracks seem to give quite different resistance, and therefore robot does not drive straight, but curves. I did select only minimal speeds with the joystick, and even with that the robot already moves so fast! Seeing that 5m/s on the ground sounds reasonable, a real 1.2kg power robot. I did upload video taken to youtube (has the sound), and extracted the first 5s long drive using makeagif.com -- I like it:

https://www.youtube.com/watch?v=vJfdLPI ... e=youtu.be
Image
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

CharlyDelta
Posts: 160
Joined: Thu Jul 18, 2013 4:04 am
Location: Montreal

Re: raspcatbot

Wed Mar 25, 2020 3:12 am

Pretty impressive. It gave me ideas, but I don't get that deep into programming. Thank you, Hermann, for taking the trouble to formulate all this information.

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Wed Mar 25, 2020 1:14 pm

Time to rethink the design sofar.
I did use 3S+1S as 4S lipo only because I had them.
Plan was to use two 3S+1S in parallel as a single 4S 50C 1000mAh lipo.
This eliminates the need for separate L298N.
And I just ordered 4S 95C 1300mAh lipo for 20$, just one lipo for both motors.
Next, for simple robot applications PiZeroW with one core can be sufficient.
Below is my 2nd T101 robot platform, with PiZeoW+camera, step-down converter to power the Pi, L298N and 4S lipo.

Just in case somebody else wants to go this route:

T101 with 3 wheels per side is available for 25$ currently, spare parts for 7$:
https://www.aliexpress.com/item/32813434124.html
https://www.aliexpress.com/item/32949489919.html

1500rpm gear motor as replacement for T101 builtin is available for <8$/pc:
https://www.dx.com/p/zndiy-bry-25ga-150 ... ntYKqZ7nmg
20200325_134459.jpg
20200325_134459.jpg (101.03 KiB) Viewed 1041 times
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

User avatar
HermannSW
Posts: 2386
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: raspcatbot

Wed Mar 25, 2020 9:20 pm

For investigating why raspcatbot on first drive did do the curves (although both motors got the same PWM/voltage), I disconnected the motor cables and determined the (free running) speed for left/right caterpillar motor, and for turning forward/rewind by connecting to constant voltage mains adapter.
While the left motor results are nearly perfect straight lines going through origin, the right motor and/or continuous track has problems (resistance? mechanical?).
I will do same measurements for both motors+endless tracks on my 2nd T101 platform, in case I find a better pair there I will swap.
Simple calculation to get an idea of speed, 318rpm corresponds to 1m/s:

Code: Select all

(1m/(π*0.060m))*60=318
Maybe the robot will have to be driven with a minimal speed of 1m/s ...
rpm_vs_V.1.png
rpm_vs_V.1.png (30.47 KiB) Viewed 1004 times
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/github_repo_i420toh264

Return to “Automation, sensing and robotics”