NRF24L01 and arduino does not communicate correctly - networking

I am trying to exchange data between 2 Atmega328P through NRF24L01.
1) Library and Sketch
I use the Tmh20 library here . And use the getting started sketch to start here .
I send to the first arduino witht the code bool radioNumber = 0;
and the second bool radioNumber = 1;
But i am getting nothing ( just 5 weird character on the Serial console).
2) Schema and electronic
This is an image of the schematic
and this is a picture of what i have on the breadboard
Also i plug
CE -> D7
CSN -> D8
SCK -> D13
MOSI ->D11
MISO ->D12
I add a 10 micro farad capacitor between the GND and VCC of the NRF24L01.
My voltage supply come from a power generator ( current consomption is 0.6 A for the two arduino with 2 NRF24L01 ). The power supply provide 5 V and i derive 3.3 V using an LM3940 using the first schema (simplied ) on the datasheet here
3) Symptom
Nothing appear on the Serial console except 5 weird characters.I can't see any light for activity on the NRF24 module.
If anyone have an idea about i could debug that thing ?
All the best
Vincent

If you do not see anything from what is written from the setup part of the code:
Serial.begin(115200);
Serial.println(F("RF24/examples/GettingStarted"));
Serial.println(F("*** PRESS 'T' to begin transmitting to the other node"));
it will probably be related to other things than the NRF communication itself. Have you remembered to set the baud rate in your serial monitor to 115200 baud?
Mismatch in baudrates are a common cause of weird characters shown in Serial Monitor.
Best regards,
Bjorn Erik

Related

ESP32 Heltec wifi LoRa, Waveshare e-Paper 4.2", how to connect via SPI and how to display something on the display (which library to use)?

I am trying to connect a Waveshare e-Paper display via SPI to the ESP32 board, but I can't get it to work. I am new to the electronics aspect, so I am not sure if I am connecting the pins correctly.
Waveshare provides example code for Arduino but when I flash it to my board the display does not do anything. I can see in the serial output that the sketch is flashing fine and running on the board.
I tried editing the code in the example code where the SPI.begin() happens and pass in the pins I am using (on this line).
After doing that, the code runs past the following block, so it appears the epd.init() works now.
if (epd.Init() != 0) {
Serial.print("e-Paper init failed");
return;
}
The hardware I am using:
E-Paper display: Waveshare 4.2inch E-Ink display module
Driver board: ESP32 Heltec wifi LoRa (V1)
ESP32 datasheet
If I am on a wrong path all together or if I am meant to use a different library (I came across GxEPD2, not sure if I am meant to use that one instead?), please feel free to correct me and point me in the right direction. Any help is much appreciated!
My main questions:
How do I connect the SPI display, which Pins to use?
Which library to use to display stuff on the display?
Example code of how to get started?
I am afraid that it will be hard to connect the ePaper module to the ESP32 Heltec using the standard library from Waveshare. It is probably do-able, but will require some modification on the standard ePaper library. Looking at epd-library-arduino gives these pins for SPI:
// Pin definition
#define RST_PIN 8
#define DC_PIN 9
#define CS_PIN 10
#define BUSY_PIN 7
All these pins are not freely available on the Heltec. In addition the Heltec uses SPI for LoRa and OLED. You would have to find some other pins and possibly do SPI "bit banging" (not hardware SPI). I would suggest starting with the example code from Waveshare on a ESP-WROOM-32 chip without any other external devices connected to the SPI bus. When you get this working, start porting the code over to the Heltec using different pin setup for the SPI.
GxEPD2 is a great library. I've personally used it on a ESP-WROOM-32. Note that GxEPD2 is licensed under GPLv3.0.
Both Waveshare, GoodDisplay, GxEPD2 and Adafruit GFX have a lot of example source code to get started.
I don't know if you got any further, but I am on a similar mission with a 5.65 7 colour display. I got the EPaper working using the Driver code here ESP32 Driver Board Code, but then found it was interfering with the LoRa (which had been working fine)! I am going to dig deeper but at this stage (rightly or wrongly) I made these changes to DEV_Config.h under the library and if you aren't using LoRa then at least you can validate your EPaper is working :
#define EPD_SCK_PIN 5
#define EPD_MOSI_PIN 27
#define EPD_DC_PIN 13
#define EPD_CS_PIN 17
#define EPD_RST_PIN 14
#define EPD_BUSY_PIN 2
/*
#define EPD_SCK_PIN 13
#define EPD_MOSI_PIN 14
#define EPD_CS_PIN 15
#define EPD_RST_PIN 26
#define EPD_DC_PIN 27
#define EPD_BUSY_PIN 25
*/
I wired the pins accordingly. My theory being it should be able to work on the same SPI as the LoRa, with separate CS Pin. I will be messing with this for a while so maybe come up solution. This may be related to why I was having troubles with the SDCard module I was also trying to get working on same circuit. I am a newbie so go easy on me!

doit.am 4-way motor & 16-way servo shield board not working with adafruit libraries

Got a servo + motor driver arduino shield with a robotic arm chassis from amazon. Found this link on the web :
https://github.com/SmartArduino/SZDOITWiKi/wiki/2-4ch-DC-motor-%26amp%3B-16ch-servo-shield---motor-and-servo-shield
Not enough details to help me control servos/ motors for my own project.
Tried the libraries given in the answer to this question:
doit 2-way motor & 16-way servo shield board
The libraries have been included, but i can't figure out how to use it properly. Ran the sample code as given in the adafruit website :
https://learn.adafruit.com/16-channel-pwm-servo-driver/using-the-adafruit-library
The 0th channel didn't move the servo as expected so I don't know what to try next.
Alright guys, here's the complete reply, with some precautions for future users.
The shield can be used via the library available at https://learn.adafruit.com/16-channel-pwm-servo-driver/using-the-adafruit-library.
(Shoutout to #djsfantasi ).
NOTE : One of the main things to ensure is that the 5v power supply for the servos must be separate from that of the arduino, as it messes up the servos somehow.
The motors can be powered via the given slots on the shield. All you have to do is supply the DIR and PWM values to the 1st 8 available arduino pins (after pin 0 and 1, ie, 2-9). It is pretty easy to figure out which pin controls which channel.
NOTE: Since the motor pins are available via male headers stacked very close together, i would suggest using female headers/jumper wires before connecting them to your motors. I burned my 1st shield's motor driver due to the +ve and -ve ending up shorted together.
Thanks for the replies everyone and best of luck to you guys reading this.

Arduino SPI GPS NanoHornet 1411 PM04

Good afternoon.
I am new to the SPI protocol and Arduino. Recently I came across a GPS sensor, this one: Nano Hornet 1411 PM04 (Datasheet: https://www.origingps.com/wp-content/uploads/2014/11/Nano-Hornet-ORG1411-Datasheet2.pdf).
I have read already many information a lot of about SPI (including some tutorials from Sparkfun for Arduino), but I still can't make this GPS work...
I would really appreciate if someone could help me understand how to write code for Arduino Uno that can make this sensor run.
For further information:
The pins of this sensor are displayed on page 21 of the link provided before for the datasheet (block 17: INTERFACE of the index).
The electronics schematics I have implemented is the one from the lower picture on page 25 (block 18: TYPICAL APPLICATION CIRCUIT of the index, FIGURE 11 – REFERENCE SCHEMATIC DIAGRAM - PM04 ORDERING OPTION).
Option chosen is SPI assembled (No R1, R2, R3, R4 placed).
Vcc is the 3.3 V pin source from the Arduino Uno board.
Clock, MISO, and MOSI pins are 13, 12 and 11 respectively on Arduino Uno
Slave select would be at digital pin 10.
ON_OFF signal is controlled by a transistor linked to digital pin 8, which allows the 3.3 V to make the pulse to start the device.
My bigger misunderstanding for this specific implementation is the fact that I don't know/understand how I can read from the GPS sensor or what I should send to the sensor to start transmitting the position. Besides that, I don't also understand how the data is output...
Thank you very much!
The Hornet uses the NMEA standard. You should start by reading the information on this page, this should set you on the right path.
https://playground.arduino.cc/Tutorials/GPS

Arduino analogRead function pin 0 not working

I would like to know if someone met the same problem on Arduino board. Know if there is a solution ?
My Arduino board has only 1 month. The pin 0 worked well before. I don't know if it's possible to "burn" a pin. (ex : use a too high voltage ? )
Output A0 connected to 5V Output A1 connected to V
On the screenshots you provided it shows the value on the pin, so technically speaking your analogRead has no problems. Check the link and connections. But regarding your question - yes, you can burn pin and even board with high voltage, so don't forget resistance when it's needed.
Also good practice to use arduino macro for analog pins like analogRead(A0); which is perfectly fine for arduino
Your screenshots show that the values read from A0 are changing (190 first, 300 second). That suggests that the problem lies in the electrical connection. Try to resolder the A0 connector pin, and possibly appropriate pin of the microcontroller. Check if the path leading from the connector to microcontroller pin is not cut somewhere.

pic16f877a RS232 not working

i am trying to make rs232 protocol communcication from my pic to serial port in pc I made sure all myconnections are right by connecting tx and rx of serial port each step I connect them anywhere else so I guess the circuit is ok and here it is:
http://i.imgur.com/0uVxFDC.png
this circuit I did connect in real life and just did It in proteus to demonstrate
I just want the pic to send every byte it receives and I set the baud rate and stop, parity bits the same in both. I made the code in mikroc, here it is:
char uart_rd;
void main() {
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
while (1) { // Endless loop
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read(); // read the received data,
UART1_Write(uart_rd); // and send data via UART
}
}
}
just this small part. I don't really know where the problem is everything seems right but it is not working I would very much appreciate replies from anyone it would really help me a lot thanks in advance
On the schematic P1 appears to be a DE-9 connector with pin 2 wired as an input and pin 3 as an output. A PC is wired the same way. If P1 is a male connector you must use a null modem cable between your circuit and the PC. A null modem cable has female connectors on both ends with signals crossed over internally. If P1 is a female connector wire pin 2 as the output and pin 3 as the input and use a male to female cable.

Resources