Not sure of receiver output Need some help

I am having all sorts of trouble getting a transmitter/receiver working on UNO.

I currently have the trans and receive DATA pins hard wired.

Have enclosed a jpg of this. Apologies for poor pic quality.

Have seen and read so many installation instructions I am pretty sure my pin setups are correct.

The following sketches are the first I have able to receive anything on the receiver side.

]TRANSMITTER SKETCH

#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile

RH_ASK driver;

void setup()
{
    Serial.begin(9600);	  // Debugging only
    if (!driver.init())
         Serial.println("init failed");
}

void loop()
{
    const char *msg = "hello";

    driver.send((uint8_t *)msg, strlen(msg));
    driver.waitPacketSent();
    delay(200);
}

RECEIVER CODE

#include <RH_ASK.h>
#include <SPI.h> // Not actualy used but needed to compile

RH_ASK rf_driver;

void setup()
{
  //Initial ASK Object
  rf_driver.init();

    
 Serial.begin(9600);	// Debugging only
 
  }  

void loop()
{
  Serial.println ("Start LOOP");
    uint8_t buf(24);
    uint8_t buflen = sizeof(buf);
    //uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
    //uint8_t buflen = sizeof(buf);
    
    Serial.println ("After setting buffer size");
    if (rf_driver.recv(buf, &buflen)) // Non-blocking

   
    {
  Serial.println("Message Received");
  Serial.println ((char*)buf);
  delay (20000);

	// Message with a good checksum received, dump it.
	//driver.printBuffer("Got:", buf, buflen);
    }
}

The attached JPG shows a screen print of the serial monitor output.

Could someone please help me??

How about some information, preferably links to datasheets, about exactly what transmitter and receiver you are using? They're not all the same.

Steve

try:

driver.send((uint8_t *)msg, strlen(msg) + 1);

Thanks for the assistance.

The Rec. & Trans. units are the cheap EBay specials.

Transmitter 2008-8 FS1000A

Receiver 080408 mx rm- 5v.

Arduino_new, I tried your suggestion and changed the Transmitter sketch.

Would not compile as ;

"driver.send((uint8_t *)msg, strlen(msg) + 1);

changed it to;

"rf_driver.send((uint8_t *)msg, strlen(msg) + 1);

and this compiled OK but the output on the Receiver monitor is exactly the same as before. :confused:

Post full details of the hardware and libraries you are using please, this is very important.

try replace () by here:

uint8_t buf[24];

Tried

“driver.send((uint8_t *)msg, strlen(msg) + 1);”

and

" driver.send((uint8_t buf[24])msg, strlen(msg) + 1);"

Neither will compile

error

Arduino: 1.8.5 (Windows 7), Board: "Arduino/Genuino Uno"
D:\AAAAAAA-Arduino 1.8.5\Arduino\arduino-builder -dump-prefs -logger=machine -hardware D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware -tools D:\AAAAAAA-Arduino 1.8.5\Arduino\tools-builder -tools D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\tools\avr -built-in-libraries D:\AAAAAAA-Arduino 1.8.5\Arduino\libraries -libraries C:\Users\farty\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10805 -build-path C:\Users\farty\AppData\Local\Temp\arduino_build_621266 -warnings=none -build-cache C:\Users\farty\AppData\Local\Temp\arduino_cache_978580 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\tools\avr -verbose C:\Users\farty\Desktop\ask_transmitter\ask_transmitter.ino\ask_transmitter.ino.ino
D:\AAAAAAA-Arduino 1.8.5\Arduino\arduino-builder -compile -logger=machine -hardware D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware -tools D:\AAAAAAA-Arduino 1.8.5\Arduino\tools-builder -tools D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\tools\avr -built-in-libraries D:\AAAAAAA-Arduino 1.8.5\Arduino\libraries -libraries C:\Users\farty\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10805 -build-path C:\Users\farty\AppData\Local\Temp\arduino_build_621266 -warnings=none -build-cache C:\Users\farty\AppData\Local\Temp\arduino_cache_978580 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\tools\avr -verbose C:\Users\farty\Desktop\ask_transmitter\ask_transmitter.ino\ask_transmitter.ino.ino
Using board ‘uno’ from platform in folder: D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr
Using core ‘arduino’ from platform in folder: D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr
Detecting libraries used…
"D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-ID:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\cores\arduino” “-ID:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\farty\AppData\Local\Temp\arduino_build_621266\sketch\ask_transmitter.ino.ino.cpp” -o "nul"
"D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-ID:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\cores\arduino” “-ID:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Users\farty\Documents\Arduino\libraries\RadioHead” “C:\Users\farty\AppData\Local\Temp\arduino_build_621266\sketch\ask_transmitter.ino.ino.cpp” -o "nul"
"D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-ID:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\cores\arduino” “-ID:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Users\farty\Documents\Arduino\libraries\RadioHead” “-ID:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\libraries\SPI\src” “C:\Users\farty\AppData\Local\Temp\arduino_build_621266\sketch\ask_transmitter.ino.ino.cpp” -o "nul"
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RHCRC.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RHDatagram.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RHGenericDriver.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RHGenericSPI.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RHHardwareSPI.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RHMesh.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RHNRFSPIDriver.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RHReliableDatagram.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RHRouter.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RHSPIDriver.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RHSoftwareSPI.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RH_NRF24.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RH_NRF905.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RH_RF22.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RH_RF24.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RH_RF69.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RH_RF95.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RH_Serial.cpp
Using cached library dependencies for file: C:\Users\farty\Documents\Arduino\libraries\RadioHead\RH_TCP.cpp
Using cached library dependencies for file: D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\libraries\SPI\src\SPI.cpp
Generating function prototypes…
"D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-ID:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\cores\arduino” “-ID:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Users\farty\Documents\Arduino\libraries\RadioHead” “-ID:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\libraries\SPI\src” “C:\Users\farty\AppData\Local\Temp\arduino_build_621266\sketch\ask_transmitter.ino.ino.cpp” -o "C:\Users\farty\AppData\Local\Temp\arduino_build_621266\preproc\ctags_target_for_gcc_minus_e.cpp"
"D:\AAAAAAA-Arduino 1.8.5\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c+±kinds=svpf --fields=KSTtzns --line-directives "C:\Users\farty\AppData\Local\Temp\arduino_build_621266\preproc\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch…
"D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-ID:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\cores\arduino” “-ID:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Users\farty\Documents\Arduino\libraries\RadioHead” “-ID:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\libraries\SPI\src” “C:\Users\farty\AppData\Local\Temp\arduino_build_621266\sketch\ask_transmitter.ino.ino.cpp” -o "C:\Users\farty\AppData\Local\Temp\arduino_build_621266\sketch\ask_transmitter.ino.ino.cpp.o"
C:\Users\farty\Desktop\ask_transmitter\ask_transmitter.ino\ask_transmitter.ino.ino: In function ‘void loop()’:
ask_transmitter.ino:25: error: expected initializer before 'driver’
driver.send((uint8_t )msg, strlen(msg) + 1);
** ^
*
Using library RadioHead in folder: C:\Users\farty\Documents\Arduino\libraries\RadioHead (legacy)
Using library SPI at version 1.0 in folder: D:\AAAAAAA-Arduino 1.8.5\Arduino\hardware\arduino\avr\libraries\SPI
exit status 1
expected initializer before 'driver’

Steve,

Not sure what you mead by data sheets for these items.

They are both generic units from EBay and are real cheepies.

The only markings on them are as previously stated and the do not have any data sheets.

I am using RadioHead 1.84 Library downloaded from "Index of /mikem/arduino

/RadioHead/

Sorry to be so vague but I am new to all this.

Thanks for your help.

Gerry

Farticus:
Not sure what you mead by data sheets for these items.

They are both generic units from EBay and are real cheepies.

The only markings on them are as previously stated and the do not have any data sheets.

You could at least provide links to the EBay listing where you bought them. So far you’ve told us nothing, not even what frequency they’re supposed to work on or why you think the RadioHead library might work with them.

If you want help you need to provide some information to work with…so far we can’t see what you have, what installation instructions you’ve read or how everything is connected.

Steve

Unbranded cheap stuff from eBay with no datasheets - without RF testgear? Could be very uphill
struggle I fear. Can you arrange to obtain a known working Rx or TX with which to test its
unknown counterpart? Otherwise you have no knowledge of which side is the problem.

I am pretty sure my pin setups are correct.

I currently have the trans and receive DATA pins hard wired.

What does that mean, and how have you done this?

Often there is direct connection between the two Arduinos to eliminate the radios and test the code, but you are running the standard radiohead library examples for RH.ASK.h and this is known good code.

For the code test, the pin on the Arduino which is going to the TX of its module is not connected to the module, but instead is connected directly to the pin on the other Arduino which would normally be connected to the RX pin of its module.

Sorry for my lack of info. I am very new to this and am not really sure what was required.

This is the EBay link.

This is a diagram of my connections to bypass the radio connection using the RadioHead sketch

505f085c77650c0a091db7b820fe0ff9198b9441.png

The default TX pin is 12 and the default RX pin is 11. The pin 12 to pin 12 connection is wrong. I have done some testing with my modules, and you may be able to run the direct connection and the radios at the same time, but you really learn nothing by doing this. The direct connection is to test code without the radios powered or attached.

You need to start by running the exact library example sketches before you start modifying the sketches.

Your code has issues which were pointed out, but you have not fixed.

uint8_t buf(24);

Thank you CatleDog for your response.

This is how I have modified the Receiver code

 Serial.println ("Start LOOP");
                        uint8_t buf(24);
                        uint8_t buflen = sizeof(buf);
                                                               //uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
                                                              //uint8_t buflen = sizeof(buf);
   
                        Serial.println ("After setting buffer size");
                        if (rf_driver.recv(buf, &buflen)) // Non-blocking

   
    {
  Serial.println("Message Received");
  Serial.println ((char*)buf);
  delay (20000);

  // Message with a good checksum received, dump it.
  //driver.printBuffer("Got:", buf, buflen);
    }

I am not sure where "uint8_t buf(24);" goes so I have put it this way

Can you let me know if this is correct?

Now have tx on pin 12 and rx on pin 11 ???

Thank you

As pointed out in reply #5

uint8_t buf[24];

Sorry,Still not much help.

My question was is the code correct?

If not where have I gone wrong?

I am sorry but I must be really dumb and restating "uint8_t buf[24];" does not seem to help me.

Where does this go?

Do i have to delete a line of code in the sketch and and replace it with "uint8_t buf[24];"?

Do I have to change some portion of a particular line of text and replace just that portion with "uint8_t buf[24];??

Thanks for your help

My question was is the code correct?

No.

If not where have I gone wrong?

You have used the syntax uint8_t buf(24) instead of uint8_t buf[24]

Do i have to delete a line of code in the sketch and and replace it with "uint8_t buf[24];"?

Yes.

// uint8_t buf(24);
uint8_t buf[24];

Where in the radio head ASK example did you find the use of the parenthesis instead of the square brackets? Why are you still running your code instead of the library example code?

In fact, you commented out the correct syntax and replaced it with your version. What motivated you to do that?

//uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
 //uint8_t buflen = sizeof(buf);

Thanks for your patience.

Old eyesight caused the ((((( [[[[[[[[ error.Should have used my glasses.

I will start from scratch and download the RadioHead sketches from the "sample " selection and will try again.

Let you know how you go.

Thanks

Thanks mate at least its now working in a fashion.

Will not work wirelessly but works ok hard wired data to data.

Two things you may be able to help with.

  1. The data output at the receiver is in Hex output.

  2. Why is it that when I disconnect the USB power to the transmitter unit and replace it with an external power source (Outputting 5v at Arduino 5v pin the transmission stops.

I thought the sketch was uploaded to the Arduino EEPROM and would still work.