I am attempting to get a simple connection between two Arduino pro mini boards using nRf24l01 modules, where one board is a transmitter that sends an int sized message(4 bytes?) that is the current value read from a potentiometer on pin A0, the Arduino acting as the sender is powered by a traditional 9v battery(real voltage is 8.2V). The receiver Arduino is powered by a USB to serial thingy, like FTDI or something, and is connected to my windows PC. Both Arduinos show red LEDs when power is given and the voltage across the VCC and GND terminals is 3.3V( I am using an AMS1117 with a 100uf cap and a .1uf cap to change arduino 5V to 3.3V). When i start the two Arduino with their associated code the serial monitor has out put like this:
0 //reciever powered on
0
0
0
0
0
0
0 //transmitter powered on
123
224
0
0
0 //new serial output ceases
If i power on the receiver first it will spit out 0 to the console repeatedly, as soon as i switch on the transmitter a few random numbers appear to be received(repeated multiple times, numbers are random) and then the Arduino stops printing to the serial monitor.
Transmitter Connections:
A0 - pot pin
GND - pot gnd
VCC - pot vcc
D12 - MISO
D11 - MOSI
D13 - SCK
D9 - CE
D10 - CSN
RAW - 9V battery VCC
GND - 9V battery GND
Reciever Connections:
A0 - pot pin
GND - pot gnd
VCC - pot vcc
D12 - MISO
D11 - MOSI
D13 - SCK
D9 - CE
D10 - CSN
TX - RX of USB FTDI
RX - TX of USB FTDI (Receiver is connected to windows pc USB with an FTDI adapter)
Transmitter Code:
/*
Created by Yvan / https://Brainy-Bits.com
This code is in the public domain...
You can: copy it, use it, modify it, share it or just plain ignore it!
Thx!
*/
#include "nRF24L01.h"
#include "RF24.h"
#include "SPI.h"
int SentMessage[1] = {000};
RF24 radio(9,10);
const uint64_t pipe = 0xE6E6E6E6E6E6;
void setup(void)
{
radio.begin();
radio.openWritingPipe(pipe);
}
void loop(void)
{
SentMessage[0] = map(analogRead(0),0,1023,0,100);
radio.write(SentMessage, 1);
delay(100);
}
Receiver Code:
/*
Created by Yvan / https://Brainy-Bits.com
This code is in the public domain...
You can: copy it, use it, modify it, share it or just plain ignore it!
Thx!
*/
#include "nRF24L01.h"
#include "RF24.h"
#include "SPI.h"
int ReceivedMessage[1] = {000};
RF24 radio(9,10);
const uint64_t pipe = 0xE6E6E6E6E6E6;
void setup(void)
{
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();
}
void loop(void)
{
while (radio.available())
{
radio.read(ReceivedMessage, 1); // Read information from the NRF24L01
Serial.println(ReceivedMessage[0]);
delay(10);
}
}
Feels likely my 5V to 3.3V setup is the issue(AMS1117 and caps), what should i do to prevent what seems like a crash or loss off power on one of the Arduinos or nRF modules?