——
#DonLucElectronics #DonLuc #RadioFrequency #Moteino #Send #Receive #ASK #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Send and Receive
These RF Transmitter Modules are very small in dimension and have a wide operating voltage range. The low cost RF Transmitter can be used to transmit signal up to 100 meters. It is good for short distance, battery power device development. These wireless transmitters work with 433 MHz receivers. They are breadboard friendly and also work great with microcontrollers to create a very simple wireless data link.
Amplitude-Shift Keying
Amplitude-Shift Keying, or ASK, is a form of amplitude modulation that represents digital data as variations in the amplitude of a carrier wave. In an ASK system, a symbol, representing one or more bits, is sent by transmitting a fixed-amplitude carrier wave at a fixed frequency for a specific time duration. For example, if each symbol represents a single bit, then the carrier signal could be transmitted at nominal amplitude when the input value is 1, but transmitted at reduced amplitude or not at all when the input value is 0.
These modules use a technique known as Amplitude Shift Keying to transmit digital data over the radio. In amplitude shift keying, the amplitude of the carrier wave, 433 MHz signal in our case, is modified in response to an incoming data signal.
DL2211Mk06
2 x Moteino R2 (RFM12B)
1 x Lithium Ion Battery – 1 Ah
1 x SparkFun FTDI Basic Breakout – 5V
1 x SparkFun Cerberus USB Cable
Moteino R2 (Send)
TR0 – Digital 2
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
VIN – +3.3V
GND – GND
DL2211Mk06ps.ino
/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Moteino ASK - Mk03
26-03
Send
DL2211Mk06ps.ino
2 x Moteino R2 (RFM12B)
1 x Lithium Ion Battery - 1Ah
1 x SparkFun FTDI Basic Breakout - 5V
1 x SparkFun Cerberus USB Cable
*/
// Include the Library Code
// RFM12B Radio
#include <RFM12B.h>
// Sleep
#include <avr/sleep.h>
// You will need to initialize the radio by telling it what ID
// it has and what network it's on
// The NodeID takes values from 1-127, 0 is reserved for sending
// broadcast messages (send to all nodes)
// The Network ID takes values from 0-255
// By default the SPI-SS line used is D10 on Atmega328.
// You can change it by calling .SetCS(pin) where pin can be {8,9,10}
// Network ID used for this unit
#define NODEID 2
// The network ID we are on
#define NETWORKID 99
// The node ID we're sending to
#define GATEWAYID 1
// # of ms to wait for an ack
#define ACK_TIME 50
// Serial
#define SERIAL_BAUD 115200
// Encryption is OPTIONAL
// to enable encryption you will need to:
// - provide a 16-byte encryption KEY (same on all nodes that talk encrypted)
// - to call .Encrypt(KEY) to start encrypting
// - to stop encrypting call .Encrypt(NULL)
uint8_t KEY[] = "ABCDABCDABCDABCD";
// Wait this many ms between sending packets
int interPacketDelay = 1000;
// Input
char input = 0;
// Need an instance of the RFM12B Radio Module
RFM12B radio;
// Send Size
byte sendSize = 0;
// Payload
char payload[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890~!@#$%^&*(){}[]`|<>?+=:;,.";
// Request ACK
bool requestACK = false;
// LED
int iLED = 9;
// Software Version Information
String sver = "26-03";
void loop()
{
// is RFM12B Radio
isRFM12BRadio();
// Inter Packet Delay
delay(interPacketDelay);
}
getRFM12BRadio.ino
// RFM12B Radio
void isSetupRFM12BRadio(){
// RFM12B Radio
radio.Initialize(NODEID, RF12_433MHZ, NETWORKID);
// Encryption
radio.Encrypt(KEY);
// Sleep right away to save power
radio.Sleep();
// Transmitting
Serial.println("Transmitting...\n\n");
}
// is RFM12 BRadio
void isRFM12BRadio(){
// Serial input of [0-9] will change the transmit delay between 100-1000ms
if (Serial.available() > 0)
{
// Input
input = Serial.read();
// [1..9] = {100..900}ms; [0]=1000ms
if (input >= 48 && input <= 57)
{
// Inter Packet Delay
interPacketDelay = 100 * (input-48);
if (interPacketDelay == 0) interPacketDelay = 1000;
Serial.print("\nChanging delay to ");
Serial.print(interPacketDelay);
Serial.println("ms\n");
}
}
// Serial
Serial.print("Sending[");
Serial.print(sendSize+1);
Serial.print("]:");
for(byte i = 0; i < sendSize+1; i++)
Serial.print((char)payload[i]);
// Request ACK every 3rd xmission
requestACK = !(sendSize % 3);
// Wakeup
radio.Wakeup();
// Turn the LED on HIGH
digitalWrite( iLED , HIGH);
// Send
radio.Send(GATEWAYID, payload, sendSize+1, requestACK);
// Request ACK
if (requestACK)
{
Serial.print(" - waiting for ACK...");
if (waitForAck()) Serial.print("ok!");
else Serial.print("nothing...");
}
// Turn the LED on LOW
digitalWrite( iLED , LOW);
// Sleep
radio.Sleep();
// Send Size
sendSize = (sendSize + 1) % 88;
// Serial
Serial.println();
}
// Wait a few milliseconds for proper ACK, return true if received
static bool waitForAck(){
// Now
long now = millis();
// ACK
while (millis() - now <= ACK_TIME){
if (radio.ACKReceived(GATEWAYID)){
return true;
}
}
return false;
}
setup.ino
// Setup
void setup(){
// Serial
Serial.begin(SERIAL_BAUD);
// LED
pinMode( iLED , OUTPUT);
// RFM12B Radio
isSetupRFM12BRadio();
}
——
Moteino R2 (Receive)
TR0 – Digital 2
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
VIN – +3.3V
GND – GND
DL2211Mk06pr.ino
/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Moteino ASK - Mk03
26-03
Receive
DL2211Mk06pr.ino
2 x Moteino R2 (RFM12B)
1 x Lithium Ion Battery - 1Ah
1 x SparkFun FTDI Basic Breakout - 5V
1 x SparkFun Cerberus USB Cable
*/
// Include the Library Code
// RFM12B Radio
#include <RFM12B.h>
// You will need to initialize the radio by telling it what ID
// it has and what network it's on
// The NodeID takes values from 1-127, 0 is reserved for sending
// broadcast messages (send to all nodes)
// The Network ID takes values from 0-255
// By default the SPI-SS line used is D10 on Atmega328.
// You can change it by calling .SetCS(pin) where pin can be {8,9,10}
// Network ID used for this unit
#define NODEID 1
// The network ID we are on
#define NETWORKID 99
// Serial
#define SERIAL_BAUD 115200
// Encryption is OPTIONAL
// to enable encryption you will need to:
// - provide a 16-byte encryption KEY (same on all nodes that talk encrypted)
// - to call .Encrypt(KEY) to start encrypting
// - to stop encrypting call .Encrypt(NULL)
uint8_t KEY[] = "ABCDABCDABCDABCD";
// Need an instance of the RFM12B Radio Module
RFM12B radio;
// LED
int iLED = 9;
// Software Version Information
String sver = "26-03";
void loop() {
// is RFM12B Radio
isRFM12BRadio();
}
getRFM12BRadio.ino
// RFM12B Radio
void isSetupRFM12BRadio()
{
// RFM12B Radio
radio.Initialize(NODEID, RF12_433MHZ, NETWORKID);
// Encryption
radio.Encrypt(KEY);
// Transmitting
Serial.println("Listening...");
}
// is RFM12 BRadio
void isRFM12BRadio()
{
// Receive
if (radio.ReceiveComplete())
{
// CRC Pass
if (radio.CRCPass())
{
// Serial
Serial.print('[');
Serial.print(radio.GetSender());
Serial.print("] ");
// Can also use radio.GetDataLen() if you don't like pointers
for (byte i = 0; i < *radio.DataLen; i++)
{
Serial.print((char)radio.Data[i]);
}
// Turn the LED on HIGH
digitalWrite( iLED , HIGH);
// ACK Requested
if (radio.ACKRequested())
{
// Send ACK
radio.SendACK();
Serial.print(" - ACK Sent");
}
// Turn the LED on LOW
digitalWrite( iLED , LOW);
}
else
{
// BAD-CRC
Serial.print("BAD-CRC");
}
// Serial
Serial.println();
}
}
setup.ino
// Setup
void setup()
{
// Serial
Serial.begin(SERIAL_BAUD);
// LED
pinMode( iLED , OUTPUT);
// RFM12B Radio
isSetupRFM12BRadio();
}
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc






























