Control transistor H-bridge with IR-remote

Hi, I am new to this site and would like to get som help with the coding of my Arduino project. This project is an DC-motor driven drop-down for my window. With a H-bridge made of PNP and NPN transistorns the motor rotates right and left. I have a code that switches the H-bridge between the two states with a delay between to make the drop-down scroll up and down repeatedly.

Now what I need help with is putting together a code that makes me able to control the H-bridge with an IR-remote. I guess this might be quite simple for some of you. Below I will list some stuff you might find useful helping me!

|500x355

|500x293

void setup() { pinMode(6, OUTPUT); // State "A" pinMode(7, OUTPUT); // State "B" } void loop() { digitalWrite(6, HIGH); // turn right digitalWrite(7, LOW); delay(2000); // wait 2 sec digitalWrite(7, LOW); // turn left digitalWrite(9, HIGH); delay(1000); // wait one sec }

IR-remote will be connected to pin 5!

Thanks in advance

When a code from the RC is received, check what should be done for that specific code, and continue accordingly. Like with Serial, when a 'u' is received, move up, when a 'd' is received, move down, and so on.

Did you already explore the codes of the RC buttons?

Hi, Please note in all these circuits; |500x293 You cannot use the arduino 5V as the supply for the motor, the arduino cannot supply the current needed. Also you need protection diodes on each of the transistors, to protect them from back emf spikes from the motor.

In all cases you have shown, you can only use a 5V supply for the motors, if you increase the supply volts the top transistor of the H-Bridge will not turn OFF when you go to turn the lower transistor ON.

Tom.... :)

You probably need a hand from Ken Shirriff and his IR library to read the codes from your remote.

The transistors also tend to burn each other, when the input signal is not close enough to Vcc or Gnd, i.e. after every controller reset. Without a signal, both the pnp and npn transistor of a half bridge are on.

I'd spend another transistor, that turns on the transistors on opposite sides of the H, which are both on or off in normal operation.

I have managed to record the recieved codes for each button. (tho I am only going to use a few I guess)

|332x500

I have edited my layout for the circuit and it is now connected to vin instead. As now vin is connected to a 8-9 V batterypack.

Right now I cant get the circuit to work. Atleast not the H-bridge. The IR-reciever works fine.

I have a prototype for the H-bridge which works, but my "real" circuitboard that is made after my posted layout does not work.

Will post pictures as soon as I can.

Huge thanks to all of you, I hope I can explain good enough for you to understand.

Modify your circuit like this (attached). Sorry for the incomplete image, I’m too stupid for using the paint tool :frowning:
HBridge.png
Add another transistor for the other half of the bridge.

Hi, As I said,

In all cases you have shown, you can only use a 5V supply for the motors, if [u]you increase the supply volts the top transistor of the H-Bridge will not turn OFF when you go to turn the lower transistor ON.[/u]

Tom.... :)

Is there a compelling reason to use a home-brewed h-bridge? There are a zillion different ones available off the shelf (but I’m sure you know that), like here at Pololu (I use the 2130).

Code attached (which is very untidy and is one of my very first Arduino programs) controls a robot through a 298 with a TV remote.

jimIR_controls_MM.ino (6.25 KB)