Introduction: How to Use Less Arduino Pins With the L293d
Those of us who use the arduino to control an L293d to drive motors always use 6 pins from the arduino to control the L293D chip. Well I was using this motor-shield from Sparkfun.It uses an l298 chip, but they used only four pins from the arduino to control it. So i tried the same with the l293d and it worked.
Step 1: The Ardumoto From Sparkfun
As can be seen near the L298d are two smaller chips. These are inverters . The schematic is below
Step 2: The Schematic Diagram of the Ardumoto Shield
Step 3: The Standard L293D Schematic
As can be seen from the diagram there are six wires used from the arduino. If you want to add a couple more L293ds to your project you won't have enough pins for sensors or other things. Yes you can use the analog pins as digital by labeling them as such in your sketch. Why not simply use a couple of NPN transistors and four resistors and you save two pins which can be used for functions. The following is what I came up with.
2 NPN transistors - i used 2N3904's any small NPN will do
2 1Kohm 1/4W resistors
2 10Kohm 1/4W resistors
and jumper wires
I initially used a a 74HC04 inverter chip, which has 6 inverters on it but decided to use the transistors because the chip would be overkill.
As can be seen from the schematic diagram.IN1 goes to IN1 of the L293 and to R1. The signal from the collector is the opposite of IN1 which is fed . IN2. The same happens with Q2.
The code for this was the modified code used by Rui Santos to show the control of motors with Bluetooth. I tried his design and it worked with Bluetooth. This instructable is not about Bluetooth control but about using less pins.
attached is the sketch for this.
The L293 is the lower power version of the L298. I used the same idea as Sparkfun when I built this controller for four motors
6 years ago
By Using Arduino --
I want at 10 PM all my home lights should OFF and at 6 AM same should be ON.
I have set up the Arduino Uno board with DS3231 RTC but only unable to tell Arduino to read that particular time (from 10PM to 6AM) from RTC and to execute the task.
Kindly suggest all the possible method.
Reply 6 years ago
I would like very much to give you a solution to your problem. I am good with hardware but not good with programming. Go to this site, he has a write up on RTC,
6 years ago
Good idea. That could be really useful in a lot of projects.