Hallo Forum,
Ich habe eine kleine Testroutine für NRF24 Module an Arduino Nano am Laufen- Aufbau und Codes sind im Wesentlichen nach diesem Tutorial.
Mit zwei Standard-Power Modulen wie diesen hier:
Läuft die Übertragung problemlos.
Wenn ich aber auf der Sendeseite den HF-stärkeren "NRF24L01+PA" (seiehe Bild)
einsetze, ist Schluß mit lustig. Ich bekomme keine Übertragung hin.
Beide Module hängen an den 3,3V des jeweiligen Nano, parallel sitzt der empfohlene 10uF C. Die Pin-Beschaltung des Powermoduls ist offensichtlich gleich wie beim Standard-Power. Leider habe ich nur ein Datenblatt für den Standand finden können, nicht für den Powertyp.
Seltsam finde ich die Stromaufnahme: Standard-NRF + Arduino nehmen beim Einschalten für kurze Zeit ca. 27mA auf. Dann springt der Strom auf 40 mA und bleibt dort stabil. Wenn aber der Power-NRF am Nano hängt, ist so ein verzögerter "Anstieg" nicht erkennbar. Der Strom ist konstant ca. 35mA, also sogar niedriger als beim Standard-Typ???
Nachdem ich beim ersten Powermodul diesen Fehlschlag hatte, habe ich zwei weitere Exemplare bestellt. Alle drei sind allerdings in gleicher Weise "Arbeitsverweigerer".
Zur Vollständigkeit hier der Code für den Sendeteil;
Und hier für den Empfänger:Code:/* Tranmsitter code for the Arduino Radio control with PWM output * Install the NRF24 library to your IDE * Upload this code to the Arduino UNO, NANO, Pro mini (5V,16MHz) * Connect a NRF24 module to it: Module // Arduino UNO,NANO GND -> GND Vcc -> 3.3V CE -> D9 CSN -> D10 CLK -> D13 MOSI -> D11 MISO -> D12 This code transmits 1 channels with data from pins A0 POTENTIOMETER Please, like share and subscribe : https://www.youtube.com/c/ELECTRONOOBS */ #include <SPI.h> #include <nRF24L01.h> #include <RF24.h> const uint64_t my_radio_pipe = 0xE8E8F0F0E1LL; //Remember that this code should be the same for the receiver RF24 radio(9, 10); // The sizeof this struct should not exceed 32 bytes struct Data_to_be_sent { byte ch1; }; Data_to_be_sent sent_data; void setup() { radio.begin(); radio.setAutoAck(false); radio.setDataRate(RF24_250KBPS); radio.openWritingPipe(my_radio_pipe); sent_data.ch1 = 127; } /**************************************************/ void loop() { /*If your channel is reversed, just swap 0 to 255 by 255 to 0 below EXAMPLE: Normal: data.ch1 = map( analogRead(A0), 0, 1024, 0, 255); Reversed: data.ch1 = map( analogRead(A0), 0, 1024, 255, 0); */ sent_data.ch1 = map( analogRead(A0), 0, 1024, 0, 255); radio.write(&sent_data, sizeof(Data_to_be_sent)); }
Ich mag nicht recht glauben, dass ich drei defekte Module in zwei Lieferungen erwischt habe. Allerdings waren sie vom selben Lieferanten.Code:/* Receiver code for the Arduino Radio control with PWM output * Install the NRF24 library to your IDE * Upload this code to the Arduino UNO, NANO, Pro mini (5V,16MHz) * Connect a NRF24 module to it: Module // Arduino UNO,NANO GND -> GND Vcc -> 3.3V CE -> D9 CSN -> D10 CLK -> D13 MOSI -> D11 MISO -> D12 This code receive 1 channels and prints the value on the serial monitor Please, like share and subscribe : https://www.youtube.com/c/ELECTRONOOBS */ #include <SPI.h> #include <nRF24L01.h> #include <RF24.h> const uint64_t pipeIn = 0xE8E8F0F0E1LL; //Remember that this code is the same as in the transmitter RF24 radio(9, 10); //CSN and CE pins // The sizeof this struct should not exceed 32 bytes struct Received_data { byte ch1; }; int ch1_value = 0; Received_data received_data; /**************************************************/ void setup() { Serial.begin(9600); //We reset the received values received_data.ch1 = 127; //Once again, begin and radio configuration radio.begin(); radio.setAutoAck(false); radio.setDataRate(RF24_250KBPS); radio.openReadingPipe(1,pipeIn); //We start the radio comunication radio.startListening(); } /**************************************************/ unsigned long last_Time = 0; //We create the function that will read the data each certain time void receive_the_data() { while ( radio.available() ) { radio.read(&received_data, sizeof(Received_data)); last_Time = millis(); //Here we receive the data } } /**************************************************/ void loop() { //Receive the radio data ch1_value = 0; receive_the_data(); ch1_value = map(received_data.ch1,0,255,1000,2000); Serial.println(ch1_value); delay(500); }//Loop end
Irgendwelche Ideen von Euch, was das Problem sein könnte?
Gruß und schönes Wochenende
Uwe








Zitieren

Lesezeichen