Author Topic: GPIO Buffering Two Wheel Bot  (Read 1832 times)

0 Members and 1 Guest are viewing this topic.

Offline RussellPiBotTopic starter

  • Beginner
  • *
  • Posts: 6
  • Helpful? 1
GPIO Buffering Two Wheel Bot
« on: February 06, 2015, 01:05:25 PM »
Project – two wheel bot based on design by Stewart Watkiss / Penguin Tutor and lots of information from the SoR site e.g. motor and motor driver selection – PWM, encoders, design/assembly advice, etc.

Greetings SoR Community,

I have been spinning my wheels for days (no pun intended – well maybe) reading everything I could find on how to wire-up the Pi, motors with encoders, motor drivers and make everything work with PIGPIO and it seems I am paralyzed by information overload and the more I read the obscured the way forward becomes!

Therefore, any advice or guidance the community can provide to help me move forward with is project would be greatly appreciated.

Project details:

Current Project Stage - GPIO buffering with goal of constructing two (2) Pi-hats to mount buffering devices and input-output terminal blocks for all non-power GPIO pins.

Bot power:
>5V-3A PS supplied by 7V2 battery pack - design MagPi issue 6 John Ellerington
>DC motors use separate 6V battery pack

Project mobility code and items in-hand:

>PWM managed by PIGPIO to control the bot

>RPi A+

>Pololu 75:1 25Dx54L mm with 48 CPR Encoder part # 2275

>Pololu VNH5019 motor drivers part # 1451

>Adafruit Perma-Proto board HAT for Pi

>4N25 opto-couplers

>SN7407N shift leveler

Advice and recommendations requested with:

> GPIO pin selection and isolating device recommended for use with PID (only plan on using PD)

> GPIO pin selection and isolating device recommended for use with future bot input-output activities e.g. using I2C, interfacing with analog devices, etc.

> Circuit design for output/input isolation using a combination of opto-isolators and shift leveler with the goal of isolating the Pi from all potential electrical mishaps (I know this maybe excessive – but, fun, as I enjoy necessary complexity and learning)

>Sorting out how ground connections fit into providing electrical isolation for the Pi (or any micro-processor0 without disrupting necessary current flow.

Thank you for taking the time to read this post and for any suggestions you my share.

Cheers,


Offline mklrobo

  • Supreme Robot
  • *****
  • Posts: 516
  • Helpful? 14
  • From Dream to Design at the speed of Imagination!
Re: GPIO Buffering Two Wheel Bot
« Reply #1 on: February 06, 2015, 02:36:55 PM »
 :) Hello! Nice project!
Your request(s);
> GPIO pin selection and isolating device recommended for use with PID (only plan on using PD)
> GPIO pin selection and isolating device recommended for use with future bot input-output activities e.g. using I2C, interfacing with analog devices, etc.

I would recommend using an op amp as a comparator, to sense the halfway mark when serial is being passed. Couple this to drive an optoisolator, and you have an output; the reverse for an input.
This has the advantage of isolating, and taking a load off of your microcontroller. Any noise that makes it
way to your circuit, will not find a way through the logic comparator.(small transcients, etc.)
I can not offer any assistance with the I2C, as I am not that familiar with the contraints, except that
the transmission of it is limited.  I would recommend going to Parallax.com - forum. They have alot of
information in that area on their threads.

> Circuit design for output/input isolation using a combination of opto-isolators and shift leveler with the goal of isolating the Pi from all potential electrical mishaps (I know this maybe excessive – but, fun, as I enjoy necessary complexity and learning)
I do not understand the direction you are going with this, except to shift voltage levels to usable levels?
I had planned to use a microcontroller as a PLC, with infrared transmitting data close range to a control panel
to allow a fully functioning unit, which was isolated.

>Sorting out how ground connections fit into providing electrical isolation for the Pi (or any micro-processor0 without disrupting necessary current flow.
This would depend on your perspective of electrical - American or European?
The Germans, from my experience, uses their grounds as control power, not the hot that
we Americans use. This causes Havoc in industrial settings, where power surges causes ground
fluxes that consistantly trip machines off.
An isolation transformer will isolate your devices from the normal power, and "washes" the transiencts
out of the AC to your device; expensive!$$$
I could be more specific, if I knew more about the enviroment in which you plan to
use this, besides what was listed. Keep me posted......   ;D ;D ;D

Offline mklrobo

  • Supreme Robot
  • *****
  • Posts: 516
  • Helpful? 14
  • From Dream to Design at the speed of Imagination!
Re: GPIO Buffering Two Wheel Bot
« Reply #2 on: February 06, 2015, 04:09:51 PM »
 :) Hello! I would like to clarify one of my points...
Sorting out how ground connections fit into providing electrical isolation for the Pi (or any micro-processor0 without disrupting necessary current flow.
This would depend on your perspective of electrical - American or European?
The Germans, from my experience, uses their grounds as control power, not the hot that
we Americans use. This causes Havoc in industrial settings, where power surges causes ground
fluxes that consistantly trip off.
An isolation transformer will isolate your devices from the normal power, and "washes" the transiencts
out of the AC to your device; expensive!$$$
---  ???  ---
The reason I suggested the isolation transformer, is because I assume you will be using this in
tandeum with other devices, not listed. Otherwise, your battery pack isolates the Pi very well.
The batteries act like the ultimate filter; absorbing all transcients, looking at them at "recharge points".
Follow the manufacturers guidelines, and you can't go wrong. If you start adding other devices, they have
to "play nice" with the rest of the system that you have constructed. The surrounding noise floor can
have alot to do with your project, if the noise floor is high enough. Keep me posted.....   ;D ;D ;D

Offline RussellPiBotTopic starter

  • Beginner
  • *
  • Posts: 6
  • Helpful? 1
Re: GPIO Buffering Two Wheel Bot
« Reply #3 on: February 07, 2015, 10:23:08 AM »
mklrobo - thank you for your thoughtful comments.

First let me try and clear-up some fog from my original post.

>I am a retired, and located in the USA and a life long learner; building a small robot(s) along with support equipment for robot operations e.g workbench, combination variable power/battery charger, power supplies for the Bot, GPIO breakout boards, etc. is fun and keeps me learning new things.

>I was trained in electronics by the Navy in the late 1960s; however, while I often used the skills I acquired in the Navy my civilian training and work focused on facilities maintenance. Therefore, I am refreshing and adding to what can best be describe as outdated electronics training.

Now back to the main questions we are exploring:

"Circuit design for output/input isolation using a combination of opto-isolators and shift leveler with the goal of isolating the Pi from all potential electrical mishaps ..."


I can see how the above caused confusion as it appears I am asking for help with combining opto-isolators and shift levelers to isolate microprocessor GPIO pins from other circuits used by the Bot - I am not. 

What I was asking for help with is when to use opto-isolators to provide protection and when it would be better to use a shift leveler.

For example, because PWM is used to control speed of a DC motor by varying the average voltage level delivered to a motor by rapidly changing the pulse width over some defined period of time it seems to me one would use a shift leveler to protect the Pi GPIO pins. However, I am not sure about that so I was seeking advice from the community.


“GPIO pin selection and isolating device recommended for use with PID (only plan on using PD)”

This question was also poorly asked as I was seeking advice on what type of GPIO isolation/protection would work best with the feedback pulses from the motor encoders that will be process by the PI to ensure the motors trun at the same speed and the Bot can travel in a straight line.

The question about grounding and how it plays into protecting the raspberry Pi (processor) was answered quit nicely when you pointed out that batteries will do the job.  Your comment made me realize that I simply need the tie the grounds together of the circuits using the same power source (battery pack) and NOT use a common ground for entire Bot.

I look forward to your follow-up comments.
Thanks again.

Offline mklrobo

  • Supreme Robot
  • *****
  • Posts: 516
  • Helpful? 14
  • From Dream to Design at the speed of Imagination!
Re: GPIO Buffering Two Wheel Bot
« Reply #4 on: February 08, 2015, 09:24:42 AM »
 :) Hello!  I appreciate your feedback.  ;D
In reference to the shift leveler, I would offer a definition to bond a response;
--  A level conversion circuit is composed of a level shift circuit for supplying a level-converted signal in the same phase as the input signal and a signal in the reverse phase thereto and a follow-up circuit responsive to the earlier of the output signals of the level shift circuit for generating an output signal.
I have started, myself, on looking for such protection devices, but have not had the chance to
use the shift levelers. I recognize the logic, like a feedback for control, inherent in industrial controls.
I looked through my books for the usage of this in the protection, and have not found any yet. :-[
If no one is using this particular circuit for this purpose, you may have found a rosetta stone for the
application.
what type of GPIO isolation/protection would work best with the feedback pulses from the motor encoders that will be processed by the PI to ensure the motors trun at the same speed and the Bot can travel in a straight line?
I would use op amp comparators for the protection of I/O. I have never had a problem with this yet. Most companies
use line drivers for the short term answer; but I use the aforementioned, becuase I cherish my project(s).
Insofaras traveling in a straight line, programming will be your main tool. GPS, sonar, switches, are all
processed in such a way to achieve what you desire. The good thing about the laborious part of programming,
is that many libraries for the Beaglebone, Raspberry PI, Avalon, and propeller(parallax) have already
been written. The problem is, finding and using the appropriate library.
I think the Avalon, as sold in this forum, has some libraries in it to make life easier. I think, they even have
a camera accessory coupled with software to help in navigation and recognizing certain items. An example
of this is in on of the Robot videos, in the Video section.Please Keep me posted on your progress......   ;D ;D ;D

Offline Billy

  • Robot Overlord
  • ****
  • Posts: 132
  • Helpful? 2
Re: GPIO Buffering Two Wheel Bot
« Reply #5 on: February 09, 2015, 02:16:57 AM »
Your comment made me realize that I simply need the tie the grounds together of the circuits using the same power source (battery pack) and NOT use a common ground for entire Bot.

You need to tie the grounds together for all circuits that that communicate with each other electrically, regardless of the power source. If you use optical isolation on every wire between the uC and the motor driver, then you would not tie the grounds between the circuits. But if there is even one signal that is direct(electrically) connected, the grounds must also be connected.

Offline RussellPiBotTopic starter

  • Beginner
  • *
  • Posts: 6
  • Helpful? 1
Re: GPIO Buffering Two Wheel Bot
« Reply #6 on: February 09, 2015, 03:41:43 PM »
Billy
Quote
You need to tie the grounds together for all circuits that that communicate with each other electrically, regardless of the power source. If you use optical isolation on every wire between the uC and the motor driver, then you would not tie the grounds between the circuits. But if there is even one signal that is direct(electrically) connected, the grounds must also be connected.

Thanks - that ground info is now locked and loaded in my head (or at least in my note book) for immediate and future application!
////////////////////////////////////////////////////////////////////

mklrobo -

After obsessing over GPIO protection for days I have decided build a customized, proper Arduino uno (stripped down Arduino e.g. no USB or items not needed- at least in my mind). Doing so will allow for the setup of a Pi master-Arduino slave relationship to control the Bot motors and future analog devices. This will avoid Pi PWM gitter and bows to the Pi's digital signal preference.

That said, I will breakout the Pi A+ GPIO pins using level shifting (MCP23008) for I2C and SPI and the 4N25 optocouplers for general purpose input-output pins mounted on the Adafruit perma-proto Pi hats. Which should arrive today!

I have learned since our last exchange the SN7407N level shifter will not work well with I2C.

In addition, I will build a power distribution board for the 5V-3A PS (MagPi issue 6) already built. Finally, for good measure, I will add a 3V3 regulator to the power distribution board - one never knows. 

Thanks to Bill's post below, regarding proper grounding, I should avoid any strange issues caused by the complexities of proper PS grounding and logic grounding.

Excessive, perhaps. Fun - yes. Will there be issues I will need help with? Yes, and when issues pop-up I will reach out the good people of the SoR community straight away.

Cheers,

 


Get Your Ad Here

data_list