User avatar
seregus
Posts: 13
Joined: Wed Jul 18, 2012 1:29 pm
Contact: Website

Connect Motor controller and Raspberry PI via GPIO?

Sat Jul 21, 2012 8:03 pm

Hi all,

I've an idea about creating a wheeled robot with webcam controlled over internet using RPI as it's main board.
At the moment I'm stacked trying to make my robot move. I've got Sabertooth 2X12 R/C connected to motors and powered up also I've go Raspberry Pi up and running, but I've no clue how to connect the cables coming out of the motor controller to the GPIO...

Any help will be really appreciated!
Attachments
IMG_0307_low.jpg
IMG_0307_low.jpg (51.61 KiB) Viewed 6661 times

IanH
Posts: 68
Joined: Mon Dec 19, 2011 5:53 pm

Re: Connect Motor controller and Raspberry PI via GPIO?

Sun Jul 22, 2012 7:17 am

I've just had a quick look at the manual, and it looks like you can control it over a serial interface ('simplified serial' or 'packetised serial' will do; you won't need the 'slave select' option if you have just one of them).

The Pi has a serial port available on the GPIO header, described in detail at:
http://elinux.org/Rpi_Low-level_peripherals

You'll need to wire the TxD pin (GPIO 14) to the controller. Now the Pi has a 3.3V output, and the controller says it needs 5V 'TTL' levels, but that's probably OK - most 5V inputs actually work perfectly well driven off 3.3V.

By default the serial port gets used as a Unix console, which will get in the way of using it for your program. Handy instructions about fixing this are at:
http://www.irrational.net/2012/04/19/us ... rial-port/

Hope that helps,
Ian

User avatar
exartemarte
Posts: 361
Joined: Sat Mar 03, 2012 3:51 pm
Location: Middle England
Contact: Website

Re: Connect Motor controller and Raspberry PI via GPIO?

Sun Jul 22, 2012 8:39 am

IanH wrote:You'll need to wire the TxD pin (GPIO 14) to the controller.
And ground/0v on the Pi to ground/0v on the 2X12. My apologies if that was obvious.

User avatar
seregus
Posts: 13
Joined: Wed Jul 18, 2012 1:29 pm
Contact: Website

Re: Connect Motor controller and Raspberry PI via GPIO?

Mon Aug 06, 2012 10:27 pm

Hi,

Thank you very much, it did work! Thanks a lot! Now next steps ;-)
Thanks again!

User avatar
seregus
Posts: 13
Joined: Wed Jul 18, 2012 1:29 pm
Contact: Website

Re: Connect Motor controller and Raspberry PI via GPIO?

Sun Aug 26, 2012 7:15 pm

Well, after a while I figured out 1 PWM output of Raspberry is not an option for controlling robots.
So I continued my search and... got a very beautiful solution from Adafruit.com:
http://learn.adafruit.com/adafruit-16-c ... pberry-pi/

Size of the extra board is really small and it allows you to connect 16 motors and even organise a chain to control 992 motors (claimed by Adafruit).

After getting my own one - it didn't work straight forward, because I'm using Rasbian and I2C drivers are disabled by default, here is a good example of how to enable I2C:
http://www.skpang.co.uk/blog/archives/575

Also Anker Astro 3 battery is working perfectly to power my Raspberry and DC motors at the same time (it has 2 usb and also 9/12 switchable output)

User avatar
joan
Posts: 13557
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Connect Motor controller and Raspberry PI via GPIO?

Sun Aug 26, 2012 7:43 pm

The Pi has no problems driving servos so if that's your only need for pwm you should be ok. For instance search for servoblaster in this forum.

For other pwm needs Gordon has produced a userland service in his wiringPi C library which may be satisfactory.

User avatar
seregus
Posts: 13
Joined: Wed Jul 18, 2012 1:29 pm
Contact: Website

Re: Connect Motor controller and Raspberry PI via GPIO?

Tue Aug 28, 2012 11:42 pm

Well, thanks for reply, first of all.

But I didn't actually expect any answer, because it was kinda sharing an updates/upgrades I got.
So making it simple, yes, you can control a lot of DC/Servo motors using some small extensions for Raspberry, for example I'm using "Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface - PCA9685" as a 16 PWM output module to control 2 DC motors (movement of the robot) and 2 servo motors (moving web-cam of the robot). As a DC motor controller I selected Sabertooth as it was part of LynxMotion 4AWD robotic platform.

But instead of using cheap batteries I've bought Anker Astro 3 with 2 usb output:
1. First USB output I've soldered to add 5V power to Adafruit module
2. Second USB output is used to power up Raspberry + WebCam + WiFi dongle
3. 12V output is used to power UP DC motors.

So it's a kind of Linux based (Raspberry PI) robot controlled over Internet (my router is already setup to be accessible, through VPN, from outside world)! I'm planing to add some Gyro/Distance sensors after it's fully functional base (hope this weekend), if someone is interested, follow me up on my blog:
http://seregus.wordpress.com

Thank you very much Raspberry PI - I can walk through my home from all around the world if I have internet connection! Thank you everyone who was patience enough to answer my stupid new bee questions in robotics!
Attachments
IMG_0403.JPG
IMG_0403.JPG (35.94 KiB) Viewed 5736 times

thegoodrobot
Posts: 2
Joined: Mon Feb 15, 2016 4:24 am

Re: Connect Motor controller and Raspberry PI via GPIO?

Mon Feb 15, 2016 9:03 am

email me at [email protected] yahoo.com
with no spaces

and i will talk to you about the project i'm working on
sabertooth 2x25 with raspberry pi b+ controlling tank over the internet

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Connect Motor controller and Raspberry PI via GPIO?

Wed Feb 17, 2016 2:56 pm

thegoodrobot wrote:email me at [email protected] yahoo.com
with no spaces

and i will talk to you about the project i'm working on
sabertooth 2x25 with raspberry pi b+ controlling tank over the internet
1. don't broadcast your e-mail address to the internet.

2. I imagine that the OP has either resolved his problems or given up as he originally posted in 2012.
Doug.
Building Management Systems Engineer.

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 6 guests