Author Topic: Simply level shift problem  (Read 1854 times)

0 Members and 1 Guest are viewing this topic.

Offline totalisTopic starter

  • Full Member
  • ***
  • Posts: 89
  • Helpful? 0
Simply level shift problem
« on: December 05, 2010, 01:34:53 PM »
Basically i am converting a small RC car to use an ATMEGA328 as a control mechanism, ideally i would like to still be able to use the R/C remote to drive the car but have the ATMEGA as a 'middle man'

I have found that if i tie one of the motor outputs (electrical connection on motor) of the GND rail, the other will be either +4v or -4v.

My question is, how do i turn these +-4v signals into digital pin inputs for my microcontroller?

i have a range of transistors available as well as diodes, resistors and caps etc.

any help is appreciated


To help explain

         4v          0v         -4v
pin1    HIGH      LOW       LOW
pin2    LOW      LOW       HIGH


Many thanks

T

Offline macdad-

  • Robot Overlord
  • ****
  • Posts: 132
  • Helpful? 5
Re: Simply level shift problem
« Reply #1 on: December 05, 2010, 01:42:59 PM »
An H-Bridge can cover that just fine. With one half of the bridge connected to Pin 1 and the other half on Pin 2. Be sure to add Pull-Ups to the PNP transistors, and Pull-Downs to the NPN transistors as on startup with most MCUs, the IO pins are in a High-Z state and can accidentally create a short circuit within the bridge.

Remember to add protection diodes to the bridge as well.

Offline totalisTopic starter

  • Full Member
  • ***
  • Posts: 89
  • Helpful? 0
Re: Simply level shift problem
« Reply #2 on: December 05, 2010, 03:52:24 PM »
I may have described this problem poorly.

Basically, if Vin is negative then the output has to be HIGH (+5v)
else if Vin >= 0 , the output is LOW (0v)

@macdad, thanks for the response, i am still trying to figure out what the circuit would look like.

I have tried a Unity gain inverting amplifier but i cannot seem to make it work.

T

Offline macdad-

  • Robot Overlord
  • ****
  • Posts: 132
  • Helpful? 5
Re: Simply level shift problem
« Reply #3 on: December 05, 2010, 07:47:18 PM »
Use the attached circuit, play around with the resistor values. The big "H" is the logic output that you can interface to your microcontroller. The -4V is Vin.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Simply level shift problem
« Reply #4 on: December 05, 2010, 08:17:09 PM »
Hi,

I may have described this problem poorly.
No, it was quite clear - you want to decode the output of the H-bridge in your R/C-car.


I have tried a Unity gain inverting amplifier but i cannot seem to make it work.
Try this:


If you would be OK with "low" on ~0.7V to 5V it would be even simpler.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

 


Get Your Ad Here

data_list