Notifications
Clear all

Remote Light Switch by Wireless from Nano

1 Posts
1 Users
0 Likes
366 Views
Greg
 Greg
(@greg)
Active Member
Joined: 2 years ago
Posts: 8
Topic starter  

Hi

 

I am attempting to set up 2 x Arduino Nano’s for remote controlled 12vdc spotlight use.

 

Components:

 

2 x Arduino nano

2 x nRF24L01 wireless modules

1 x L298N Dual H Bridge module

1 x Joy Stick (same as project type)

1 x 12vdc 40RPM reversible motor (rotator)

1 x 12vdc 2rpm reversible motor (up/down)

2 x sets 2:1 ratio gear (20:40)

 

1 x 40amp 12v 5pole relay

 

Power : 12 volt dc – standard motor vehicle current.

Relevant Buck up/down to suit module power requirements and to smooth out flow.

 

The idea for this came from the DroneBot Workshop YouTube video “Wireless Joystick for Arduino Robot car with nRF24L01”.

}

I would like to use the SW (Switch) on the joy stick to remote activate the spotlight. This requires 2 x digital pins:

 

( As per Paul McWhorters Tutorials 27 & 28)- I adapted his tutes and have the Joy Stick switch operating.

int LEDState=0;

int LEDPin =8;

int buttonPin=12;

int buttonNew;

int buttonOld=1;

int dt=100;

 

void setup() {

// put your setup code here, to run once:

Serial.begin(9600);

pinMode (LEDPin, OUTPUT);

pinMode (buttonPin, INPUT);

}

void loop() {

// put your main code here, to run repeatedly:

buttonNew=digitalRead(buttonPin);

if(buttonOld==0 && buttonNew==1){

if(LEDState==0){

digitalWrite(LEDPin,HIGH);

LEDState=1;

 

}

else{

digitalWrite(LEDPin, LOW);

LEDState=0;

}

}

buttonOld=buttonNew;

delay(dt);

 

}

 

However:

 

The DroneBot video etc is based on the Uno not the Nano.

On the client end of the wireless transmission I have

1 x Nano – with effectively 12 digital pins.

1 x nRF24L01 takes up 5 pins

1 x L298N takes up 6 pins.

 

I have 1 x Digital pin left{

 

Pin Nr nano

Nrf24

L298N

JS Signal

1

 

 

 

2

 

 

 

Reset

 

 

 

GND

 

 

 

5

 

 

SW?

6~

 

IN4

 

7

 

IN3

 

8~

 

ENB

 

9~

 

ENA

 

10

 

IN2

 

11

 

IN1

 

12~

4 - CSN

 

 

13~

3 - CE

 

 

14~

6 - MOSI

 

 

15

7 - MISO

 

 

16

5 - SCK

 

 

A0

 

 

 

A1

 

 

 

 

 

Question 1.

 

On the client side will the nano require 2 pins as this will be an output to the relay.

 

If 2 pins required then:-

 

Question 2.

 

Can I use Pins 1 or 2? - I have attempted to use them with no effect

 

Can I use a Analog pin? I have attempted to use them with no effect.

 

Any help on these questions would be appreciated.


   
Quote