User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Choosing motors

Wed Mar 13, 2019 12:18 pm

tlfong01 wrote:
Tue Mar 12, 2019 3:07 pm
Reading data MPU-6050 on Rpi Python - BitiFly 2013nov07
http://blog.bitify.co.uk/2013/11/readin ... berry.html

MPU6050 References

Now I am collecting more references for programming MPU6050.

MPU6050 Datasheet R3.4 - InvenSense 2013
https://store.invensense.com/datasheets ... V3%204.pdf

MPU-6000/MPU-6050 Register Map and Register Descriptions Document V4.2 - InvenSense 2013
https://www.invensense.com/wp-content/u ... r-Map1.pdf

Washington University CSE 466 Lab 4: I2C Gyroscope control (Using Teensy)
https://courses.cs.washington.edu/cours ... l4/l4.html

An Efficient Orientation Filter For Inertial and Inertial/Magnetic Sensor Arrays - Sebastian OH Madgwick 2010Apr30
https://courses.cs.washington.edu/cours ... report.pdf

Open source IMU and AHRS algorithms - x-io tech 2012jul31
http://x-io.co.uk/open-source-imu-and-ahrs-algorithms/

MPU6050 Basic Teensy Example with IMU - Beerware by Kris Winer 2014apr10
https://courses.cs.washington.edu/cours ... 050IMU.ino
Last edited by tlfong01 on Wed Mar 13, 2019 3:12 pm, edited 2 times in total.
I am an electronics and smart home hobbyist.

Starscream205
Posts: 4
Joined: Thu Feb 28, 2019 9:58 pm

Re: Choosing motors

Wed Mar 13, 2019 1:18 pm

https://www.amazon.co.uk/gp/aw/d/B07HBN ... b_pd_title

These are the motors I am using for my robot project and they seem pretty good, I've tested them through a picon zero.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Choosing motors

Wed Mar 13, 2019 2:57 pm

Starscream205 wrote:
Wed Mar 13, 2019 1:18 pm
https://www.amazon.co.uk/gp/aw/d/B07HBN ... b_pd_title
These are the motors I am using for my robot project and they seem pretty good, I've tested them through a picon zero.

TT RS130 1/120 Motor with Hall Effect AB Encoder 1440 pulses per wheel revolution

Picon Zero looks good.

I just started testing the motors. I bought the two shaft model, wrongly thinking that I could DIY an optical encoder on one geared shaft. But then I read that the resolution is too low to do any self balancing job or gyro thing. So I bought another model with encoder at the motor shaft. I don't have the skill and knowledge to DIY that sort of sophisticated quadrature Hall effect encoder. :mrgreen:

4tronix PiCon Zero
https://4tronix.co.uk/blog/?p=1224

MiaoLab TTM1 Motor with encoder
https://item.taobao.com/item.htm?id=568690950220

Update 2019mar14 - 4tronix Robot Car with Wheel Encoder Sensors
http://4tronix.co.uk/pi2go/WheelEncoders.pdf

I visited 4tronicx and found their Pi2Go-Lite also has wheel encoders.

These simple encoders provide 16 pulses per revolution of the main wheels and allow user to program the car to:

* Travel in straight lines, even if the motors naturally move at slightly different speeds
* Travel a fixed distance
* Turn a set angle

...
Attachments
encoder_motor_2019mar1301.jpg
encoder_motor_2019mar1301.jpg (166.71 KiB) Viewed 3195 times
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Choosing motors

Thu Mar 14, 2019 4:30 am

tlfong01 wrote:
Wed Mar 13, 2019 2:57 pm
Starscream205 wrote:
Wed Mar 13, 2019 1:18 pm
https://www.amazon.co.uk/gp/aw/d/B07HBN ... b_pd_title
These are the motors I am using for my robot project and they seem pretty good, I've tested them through a picon zero.
4tronix PiCon Zero
https://4tronix.co.uk/blog/?p=1224
I visited 4tronicx and found their Pi2Go-Lite also has wheel encoders.
These simple encoders provide 16 pulses per revolution of the main wheels and allow user to program the car to:
* Travel in straight lines, even if the motors naturally move at slightly different speeds
* Travel a fixed distance
* Turn a set angle

Wheel Encoders

/ to continue, ...
...
Attachments
wheel_encoder_2019mar1402.jpg
wheel_encoder_2019mar1402.jpg (154.46 KiB) Viewed 3170 times
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Choosing motors

Thu Mar 14, 2019 4:50 am

tlfong01 wrote:
Wed Mar 13, 2019 12:18 pm
MPU6050 Datasheet R3.4 - InvenSense 2013
https://store.invensense.com/datasheets ... V3%204.pdf
MPU-6000/MPU-6050 Register Map and Register Descriptions Document V4.2 - InvenSense 2013
https://www.invensense.com/wp-content/u ... r-Map1.pdf

MPU6050 Programming Notes

Now I have written my first very simple python program which reads the MPU6050's register 0x75. The program is fully listed below.

tlfong01's MPU6050 Programming Penzu Diary
https://penzu.com/p/bcc27149

/ to continue, ......

Code: Select all

# mpu6050_test03_2019mar1401 tlfong01 2019mar14hkt1424
# Rpi3B+ stretch linux 4.14.34-v7+ arm python3.5.3

# *** Description ***

# 1. Setup I2C channel
# 2. Reset MPU
# 3. Wakeup MPU
# 4. Read and print register default value 0x68 of register 0x75 (WhoAmI)

# *** Imports ***

import smbus
from   time import sleep

# *** Device Address ***

mpu6050Addr = 0x68

# *** Register Addresses ***

whoAmIAddr     = 0x75
powerMgmt1Addr = 0x6b

# *** Control Bytes ***

resetByte  = 0x80
wakeupByte = 0x00

# *** Read Write Print Device/Register Functions ***

def writeDevTwoBytes(i2cPort, devAddrByte, dataByte1, dataByte2):
    i2cPort.write_byte_data(devAddrByte, dataByte1, dataByte2)
    return

def readDevRegOneByte(i2cPort, devAddrByte, regAddrByte):
    readByte = i2cPort.read_byte_data(devAddrByte, regAddrByte)
    return readByte

def writeDevRegOneByte(i2cPort, devAddrByte, regAddrByte, writeByte):
    writeDevTwoBytes(i2cPort, devAddrByte, regAddrByte, writeByte)
    return

def printDevRegOneByte(i2cPort, devAddrByte, regAddrByte, printTitle):
    readByte = readDevRegOneByte(i2cPort, devAddrByte, regAddrByte)
    print(printTitle, hex(readByte))

# *** MPU6050 Functions ***

def operationDelay():
    sleep(0.000020) # 20 micro seconds
    return

def resetMpu(i2cCh):
    print('      Begin resetMpu(), ...')
    writeDevRegOneByte(i2cCh, mpu6050Addr, powerMgmt1Addr, resetByte)
    operationDelay()
    printDevRegOneByte(i2cCh, mpu6050Addr, powerMgmt1Addr, '        Reg 0x6b (PowerMgmt1) =')
    print('      End   resetMpu().')
    return

def wakeupMpu(i2cCh):
    print('      Begin wakeupMpu(), ...')
    writeDevRegOneByte(i2cCh, mpu6050Addr, powerMgmt1Addr, wakeupByte)
    operationDelay()
    printDevRegOneByte(i2cCh, mpu6050Addr, powerMgmt1Addr, '        Reg 0x6b (PowerMgmt1) =')
    print('      End   wakeupMpu().')
    return 

# *** Test Functions ***

def readPrintMpu6050RegWhoAmI():
    print('      Begin readPrintMpu6050RegWhoAmI(), ...')
    printDevRegOneByte(i2cCh, mpu6050Addr, whoAmIAddr, '        Reg 0x75 (Who_Am_I)    =')
    print('      End   readPrintMpu6050RegWhoAmI().')
    return

def testMpu01():
    readPrintMpu6050RegWhoAmI()   
    return

# *** Init Functions ***

i2cCh = smbus.SMBus(1)
resetMpu(i2cCh)
wakeupMpu(i2cCh)

# *** Main ***

testMpu01()

# *** End ***

'''
# *** Begin Sample Output 2019mar14hkt1442 ***
      Begin resetMpu(), ...
        Reg 0x6b (PowerMgmt1) = 0x40
      End   resetMpu().
      Begin wakeupMpu(), ...
        Reg 0x6b (PowerMgmt1) = 0x0
      End   wakeupMpu().
      Begin readPrintMpu6050RegWhoAmI(), ...
        Reg 0x75 (Who_Am_I)    = 0x68
      End   readPrintMpu6050RegWhoAmI()
# ** End Sample Output ***
'''
Last edited by tlfong01 on Thu Mar 14, 2019 7:08 am, edited 2 times in total.
I am an electronics and smart home hobbyist.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Choosing motors

Thu Mar 14, 2019 5:31 am

tlfong01 wrote:
Thu Mar 14, 2019 4:30 am

4tronix Robots References

Amazon 4tronix Picon Zero v1.3 Intelligent Robotics Controller Board for Raspberry Pi
https://www.amazon.co.uk/4tronix-Intell ... B01E8MXQWY

robotics controller board for Raspberry Pi
Fully supported with extensive Python library
drive Servos, NeoPixels, LEDs, Motors and many other output devices
use Analog or Digital inputs, or even directly access temperatures with a DS18B20
Multiple power options for the output devices and motors

4tronix Robots summary notes

Motors

TT130 plastic geared DC3~6V motor
N20 metal geared motor
28BYJ-48 stepping motor ULN2003 boards

Motor/Servo Driver
L293DD H-Bridge motor driver
DRV8833 DC/stepping motor driver
ULN2003 stepping motor driver
PCA9685 16-channel PWM servo driver

Sensors
DS18B20
DHT11

LED
WS2812 Neopixel LED


Raspberry Robotics Robotics for beginners with the Raspberry Pi - Richard Keenes 2019mar10
https://raspberryrobotics.home.blog/
...
Attachments
picon_zero_2019mar1401.jpg
picon_zero_2019mar1401.jpg (161.48 KiB) Viewed 3160 times
I am an electronics and smart home hobbyist.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 32878
Joined: Sat Jul 30, 2011 7:41 pm

Re: Choosing motors

Thu Mar 14, 2019 9:37 am

tlfong01 wrote:
Thu Mar 14, 2019 5:31 am
tlfong01 wrote:
Thu Mar 14, 2019 4:30 am

4tronix Robots References

Amazon 4tronix Picon Zero v1.3 Intelligent Robotics Controller Board for Raspberry Pi
https://www.amazon.co.uk/4tronix-Intell ... B01E8MXQWY

robotics controller board for Raspberry Pi
Fully supported with extensive Python library
drive Servos, NeoPixels, LEDs, Motors and many other output devices
use Analog or Digital inputs, or even directly access temperatures with a DS18B20
Multiple power options for the output devices and motors

4tronix Robots summary notes

Motors

TT130 plastic geared DC3~6V motor
N20 metal geared motor
28BYJ-48 stepping motor ULN2003 boards

Motor/Servo Driver
L293DD H-Bridge motor driver
DRV8833 DC/stepping motor driver
ULN2003 stepping motor driver
PCA9685 16-channel PWM servo driver

Sensors
DS18B20
DHT11

LED
WS2812 Neopixel LED


Raspberry Robotics Robotics for beginners with the Raspberry Pi - Richard Keenes 2019mar10
https://raspberryrobotics.home.blog/
...
Can you please avoid spamming the forums with loads of links, and also reduce the amount of colour in your posts, its disconcerting and makes your posts difficult to read. Must also take ages to write for no benefit.
Principal Software Engineer at Raspberry Pi Ltd.
Working in the Applications Team.

User avatar
tlfong01
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Choosing motors

Thu Mar 14, 2019 12:40 pm

jamesh wrote:
Thu Mar 14, 2019 9:37 am
tlfong01 wrote:
Thu Mar 14, 2019 5:31 am
tlfong01 wrote:
Thu Mar 14, 2019 4:30 am

4tronix Robots References

Amazon 4tronix Picon Zero v1.3 Intelligent Robotics Controller Board for Raspberry Pi
https://www.amazon.co.uk/4tronix-Intell ... B01E8MXQWY

robotics controller board for Raspberry Pi
Fully supported with extensive Python library
drive Servos, NeoPixels, LEDs, Motors and many other output devices
use Analog or Digital inputs, or even directly access temperatures with a DS18B20
Multiple power options for the output devices and motors

4tronix Robots summary notes

Motors

TT130 plastic geared DC3~6V motor
N20 metal geared motor
28BYJ-48 stepping motor ULN2003 boards

Motor/Servo Driver
L293DD H-Bridge motor driver
DRV8833 DC/stepping motor driver
ULN2003 stepping motor driver
PCA9685 16-channel PWM servo driver

Sensors
DS18B20
DHT11

LED
WS2812 Neopixel LED


Raspberry Robotics Robotics for beginners with the Raspberry Pi - Richard Keenes 2019mar10
https://raspberryrobotics.home.blog/
...
Can you please avoid spamming the forums with loads of links, and also reduce the amount of colour in your posts, its disconcerting and makes your posts difficult to read. Must also take ages to write for no benefit.
Thank you for you advice. So I will avoid spamming links and colouring posts. My apologies for any disconcerting caused.
I am an electronics and smart home hobbyist.

jackbarks234
Posts: 1
Joined: Wed Jun 19, 2019 8:43 am

Re: Choosing motors

Wed Jun 19, 2019 8:48 am

Gavinmc42 wrote:
Mon Feb 25, 2019 2:59 am
https://en.wikipedia.org/wiki/Magnetic_gear
I get magnets from here, trying to figure out if a high ratio magnetic worm drive gear box could be made
https://supermagnetman.com/

Those TT motors are the best value for hobby bots, good to learn on.
And once those cheap motors wear out you can replace them with lower current, higher voltage 12V ones.
Because they are cheap speed can be dependent on brush wear.
Try driving in a straight line.

Replacement RS-130 size motors are low cost, even here only $1.

Is it important where you buy the magnet? Supermagnetman doesnt ship to my country, but https://magnetpartner.com/ does. I guess its pretty much the same thing? Or?

User avatar
Gavinmc42
Posts: 8020
Joined: Wed Aug 28, 2013 3:31 am

Re: Choosing motors

Thu Jun 20, 2019 1:09 am

Is it important where you buy the magnet?
Not really important, I think most are made in China anyway.
I get from Supermagnetman because he has a very wide range and I get 100's at a time.
There are wholesalers that might restock his stuff, industrial suppliers not online retailers.

Those 5mm coloured spheres look interesting, I don't have any of those ;)
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: Choosing motors

Thu Jun 20, 2019 5:44 am

I seem to be coming to this discussion very late.

How to answer the age old question that has dogged robot builders since the beginning of time "How to make my robot drive straight". I have lost count at how many hours I have spend chasing this unicorn :)

There is a few options.

1.
Stepper motors as they turn very very precise and is why they are used in CNC machines.

2.
Servo type motors that have a feed back loop on the position of the motor (usually a quadrature encoder). Basically it is a fast loop that reads the position of the encoders then if they are incorrect for what you want then it adjust the PWM power to the motor then repeats. This is not easy to do on a RPi because RPi isn't real time. It is much easier to use a MCU that has a hardware encoder counter like the STM32 MCU family.

3.
Using a feed back loop for another sensor for positioning like the MPU family of IMUs but this requires some pretty fancy coding to do sensor fusion to remain accurate


The stepper motor option will be the simplest one to implement. Just buy a stepper motor with enough torque and a Driver that can handle the need current. I suggest using micro stepping not for accuracy but rather for smoothness of motor rotation. You can see an example of both servo motors and stepper motor in action on the 5x5x5 rubik's cube solving robot I build. Servo motors open and close the grippers but all the rotation is done by steppers https://www.youtube.com/watch?v=sD4bG8hPYLQ

User avatar
Gavinmc42
Posts: 8020
Joined: Wed Aug 28, 2013 3:31 am

Re: Choosing motors

Fri Jun 21, 2019 1:49 am

I once had to drive two electric linear rams at the same speed for a solar panel tilt mechanism.
I used one of those small DSP micros from Microchip which had two encoder inputs.
All I did was keep the counts within +/-5 or 10 of each other, slow one down when it gets ahead etc.
Probably the simplest DSP coding I have ever done and it still works fine 10 years later.

Steppers are ok but can loose sync that's why most CNC machines have Zero position detectors.
DC motors with encoders are also ok.

3Phase Brushless outrunner motors with gyro/accel feedback are the newest solution.
How good these are is shown in all those camera gimbals on drones.

Could you use gyro/accel/compass with DC motors?

Well Drones are now using Arm Cortex M3/4s for stability controls, Pi's will need this too.
Could a Pi Zero be used instead of M3/4?
Probably, with latency issues?
Could the QPUs be used for the Quaterion coding?

One guy has done a drone with a Pi, so a two motor ground bot should be much easier.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “Automation, sensing and robotics”