RF Hifi Volume Control Project

Hi everyone,

I’m brand new to the forum- and to Arduino. I’ve been working on a project to add an RF volume control to a an old amplifier. I’ve been trhying to do it all myself- but I’m now stuck on a problem that seems to be above my pay grade- so I was hoping someone might be able to spot what I’m doing wrong and offer some advice…

So here goes:

Circuit components:

  1. Arduino Nano
    (I had an Arduino Nano but I accidentally destroyed it by connecting it to USB power while it was connected to raw power, so I’m using a clone from a local store temporarily. I’ve ordered a new original.)

  2. L293D motor driver:
    https://www.banggood.com/5Pcs-MINI-L293D-Arduino-Motor-Drive-Expansion-Board-Mini-L293D-Motor-Drive-Module-p-1269354.html?rmmds=buy&cur_warehouse=CN
    http://communityofrobots.com/tutorial/kawal/how-drive-dc-motor-using-l293d-arduino

  3. 315Mhz Simple RF Rciever
    Simple RF M4 Receiver - 315MHz Momentary Type : ID 1096 : $4.95 : Adafruit Industries, Unique & fun DIY electronics and kits

  4. Alps Motorised Potentiometer: (4.5v nominal)
    https://www.alps.com/prod/info/E/HTML/Potentiometer/RotaryPotentiometers/RMP_RK16/RK16812MG099.html

The circuit is very simple- a 5v high signal on either channel (pins 8 & 9) should trigger the L293D driver to command the motor forward or backward. When no signal is received the motor should be stationary. The whole circuit runs on 5VDC and shares the same power supply.

The problem I’m having is that once connected the motor driver is constantly outputting 2.2v in either direction, depending on the polarity of the IN1 and IN2 pins. That signal seems to be coming from pin 4- I measured the output with my cheap oscilloscope and it seems to be switching 4v on and off every 16ms… it exists whether or not the RF module is connected and I’m guessing this is the source of the problem.

So I’m wondering if anyone can give me any tips on how to correct it? I’ve been searching for an answer for days and it’s driving me crazy!

Any help would be very much appreciated.

Kind regards,

Zap

PS I’ve also attached a photo is the small switch bounce I get from the RF module- I’m not sure if that’s significant.

Code:

// Connection pins:
int in1 = 4; // IN1
int in2 = 5; // IN2
int volup = 8; // 5v volume up signal from receiver
int voldn = 9; // 5v volume down signal from receiver

void setup()
{
Serial.begin(9600);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(volup, INPUT);
pinMode (voldn, INPUT);
}

void loop()
{
int voluphigh = digitalRead(volup); // Volume up reading
int voldnhigh = digitalRead(voldn); // volume down reading
digitalWrite(in1, 1); // set speed of motor to high
digitalWrite(in2, 1); // set rotation direction of motor (1 or 0)

while (digitalRead(9) == LOW && digitalRead(10) == LOW && digitalRead(11) == LOW && digitalRead(12) == LOW) {
digitalWrite(in1, 0); // set motor to off
digitalWrite(in2, 0); // set rotation direction of motor (1 or 0); // Loops until button is pressed
}

while (digitalRead(9) == HIGH) { // Volume up pressed
digitalWrite(in1, 1); // set speed of motor to high
digitalWrite(in2, 0); // set rotation direction of motor (1 or 0) ;
}

while (digitalRead(10) == HIGH) { // Volume down pressed
digitalWrite(in1, 1); // set speed of motor to high
digitalWrite(in2, 0); // set rotation direction of motor (1 or 0
}

}

Just a few things that stick out.

A Nano needs at least 6volt on V-in (input of the regulator) to produce a stable 5volt on it’s 5volt pin.

An L293 is old technology, and drops typically 2.6volt in H-bridge mode at 600mA motor current.
That means you need at least a 6.6volt power supply for the L293D for 4volt on the motor.
Leo…