Uncategorized

HC12 433MHz module notes

Arduino-Pico RF433 Rf-Tx cheap modules

Ask Question

Asked today

Modified today

Viewed 18 times

1

I currently use Arduino IDE to program Raspberry Pico, using this as reference. Arduino-pico Github

My intention, is to use RadioHead library which is not available in MicroPython, to send and receive RF messages through cheap China RF modules.

I used the example code of the RH_ASK library as below, but I cannot see any results printed. Does anyone has tried this? Am I using something wrong? I have connected RF modules on UART0 pins.

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

//RH_ASK driver;
RH_ASK driver(2000, 13, 12); 
// RH_ASK driver(2000, 3, 4, 0); // ATTiny, RX on D3 (pin 2 on attiny85) TX on D4 (pin 3 
on attiny85), 
// RH_ASK driver(2000, PD14, PD13, 0); STM32F4 Discovery: see tx and rx on Orange and 
Red LEDS

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

void loop()
{   
    uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
    uint8_t buflen = sizeof(buf);



    if (driver.recv(buf, &buflen)) // Non-blocking
    {
      driver.recv(buf, &buflen);
        int i;

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

Thank you in advance

arduinopi-pico

Share

EditFollowCloseFlag

asked 8 hours ago

user avatar

Antifa

11144 bronze badges

  • How did you build the radiohead library? How do you know it built correctly. How did you link your program? – joan 6 hours ago
  • @:Antifa: Earlier I played the cheap China 433Mhz HC12, and found that using serial is easier than using SPI. I used MicroPython. The tutorial I used, and working code: (1) Understanding … 433MHz Transceiver Module allaboutcircuits.com/projects/… (2) Making a Rpi Pico Based Smart Vehicle Part 2 – tlfong01 2021nov03 forum.pi-top.com/t/making-a-rpi-pico-based-smart-vehicle-part-2/… Section 3. HC12 433MHz RF transceivers, 3.1 uart loop back functions, 3.2 HC12 transmit/receive echo functions. – tlfong01 1 min ago   Edit  

Add a comment

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.