My theatre project is a 1.5 M dia working clock project due 20th July. Two Arduino Nano RF used to control from sound desk. Motor working ok uses pins D2, D5, D8. I have 12 LED strips to control light show. Digital write works on D3,D4,D6,D7,D12 + A0,A1,A2,A3,A4,A5 configured as OUTPUT. But pins D9,D10,D11,D13 do not work? Code is simple and checked ok. Hard wiring is also simple and exhaustively checked. Libraries called
nRF24 uses the SPI pins (11,12,13); you can not use them for something else. Pin 10 is the SS pin; to my knowledge it can be used as output as long as the Nano acts as a SPI master.
Thanks.. I only need one more pin so do you know how to make the Nano to be SPI master? In fact do I need SPI.h at all since the only special functions I need are for TX /RX and Motor control all the rest is bog standard. regards
Actually the Nano with the problem is the one receiving button presses from the one at the sound desk. Does that mean it cannot be the SP master? regards..
The 328P should be the master for communication with the nRF. Setting it to output should allow you to use it as a digital output to my knowledge (but no practical experience with it).
The schematics I've been able to find for the Nano Rf show D9 - D13 being connected to the NRF24L01.
I assume you are wanting the additional output for an LED strip. What type of LED strip are you using, and are you just turning the LEDs ON/OFF at full brightness, or do you need to vary the brightness?
Thanks
I was also told that by using radio meant pins D9, D10, D11 and D13 would not be available and since the stepper controller uses D2, D5, D8 I am stuck with 11 only. So my solution is to use digital output to A0 - A5 and use pins D2, D4, D6 to send a binary digit to another slave Arduino which also runs A0 - A5 as digital output giving me 12 with no need for transistor switching to drive 12 relays. Can I connect digital outputs on one Arduino to digital inputs on another directly?
But right now I have a bigger problem my stepper motor has just failed! So where do I go to ask about that?
Right here.
You need to provide the following:
Schematic/wiring diagram of the complete set-up
Listing of the complete code (use code tags <CODE>)
Data sheets or links to a webpage for each module/component used.
Specifications of all the power sources used.
Thanks Jim..
Let me just describe the setup and the specific problems first..
I use two Arduino Nano RF chips from Ali Express no identity words on them
The sender is housed in a plastic box with 5 buttons and one switch
The 5 buttons are wired to D2, D3, D4, D5 and D7 and switch on D6
Here is the code
// constants won't change. They're used here to set pin numbers:
#include <SPI.h>
#include <RF24.h>
#include <nRF24L01.h>
#define CE_PIN 9 // D9 = Chip Enable (CE) for nRF24L01+
#define CS_PIN 10 // D10 = Chip Select (CS) for nRF24L01+
RF24 radio(CS_PIN, CE_PIN);
const uint64_t address = 0xE8E8F0F0E1; // Change this address to match the receiver's address
const int ffwd = 1;
const int slwfwd = 2;
const int slwrev = 3;
const int frev = 4;
const int lights = 5;
const int clock = 7;
const int BTN1 = 2; // ffwd pushbutton pin
const int BTN2 = 3; // slfwd
const int BTN3 = 4; // slrev
const int BTN4 = 5; // frev
const int BTN5 = 6; // clock
const int BTN6 = 7; // lights
const int LedPin = 13; // the number of the LED pin
unsigned long Tick = 0;
// variables will change:
void setup() {
// initialize the LED pin as an output:
pinMode(LedPin, OUTPUT);
digitalWrite(LedPin, LOW);
// initialize the pushbutton pins as inputs:
pinMode(BTN1, INPUT_PULLUP);
pinMode(BTN2, INPUT_PULLUP);
pinMode(BTN3, INPUT_PULLUP);
pinMode(BTN4, INPUT_PULLUP);
pinMode(BTN5, INPUT); // clock switch
pinMode(BTN6, INPUT_PULLUP);
// Configure the Radio
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(address); // For Outgoing Data
radio.setDataRate(RF24_1MBPS); // Small Bandwidth
radio.setPALevel(RF24_PA_MAX);
radio.stopListening();
}
void loop() {
// fast forward
while (digitalRead(BTN1) == LOW)
{
radio.write(&ffwd, sizeof(ffwd));
Serial.println("Sending ffwd");
delayMicroseconds(100);
}
// slow fwd Button = 2
while (digitalRead(BTN2) == LOW)
{
radio.write(&slwfwd, sizeof(slwfwd));
delayMicroseconds(100);
Serial.println("Sending slwfwd");
}
// slow rev
while (digitalRead(BTN3) == LOW)
{
radio.write(&slwrev, sizeof(slwrev));
delayMicroseconds(100);
Serial.println("Sending slwrev");
}
// fast reverse
while (digitalRead(BTN4) == LOW)
{
radio.write(&frev, sizeof(frev)); //Send instructions
delayMicroseconds(100);
Serial.println("Sending frev");
}
while (digitalRead(BTN6) == LOW)
{
radio.write(&lights, sizeof(lights)); //Send instructions
delayMicroseconds(100);
Serial.println("Sending lights");
}
if (digitalRead(BTN5) == HIGH && millis() - Tick > 1500) { // clock switch is on
// Serial.println(millis() - Tick);
radio.write(&clock, sizeof(clock)); //Send clock code 7
Tick = millis();
Serial.println("Sending clock");
}
}
The arduino is mounted in a screw terminal base stuck to the base of the case and the wiring is simply as described with a common ground to all buttons and switch.
This has worked ok on the bench but..
It takes some time (seconds to minutes) to connect at first switch on!
I am unsure if the RF can induce interference via the wiring in the box
In one instance the switch on D6 turned on without the switch being set?
The distance from this sender to the clock will be about 12 meters
Please just bear with me with one thing at a time.. Thank you
Not sure.. All I found was that using digital out on a digital pin
a) Did not light the 24 led strip to full brightness
b) Digital out on A0 - A5 did
c) Digital out on a digital pin would not switch a 12v opto coupled arduino relay module directly
Hence the second arduino to get a total of 12 analog outputs but that is not now the main issue since I swapped everything chips, controllers only to find the motor is not responding.