The Alpha Geek – Geeking Out

Moteino

Project #8: Servo – Moteino R2 (RFM12B) – Mk02

——

#DonLucElectronics #DonLuc #Servo #Moteino #Transceiver #RadioFrequency #Pololu #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Moteino R2 (RFM12B)

——

Moteino R2 (RFM12B)

——

Moteino R2 (RFM12B)

——

Moteino

Moteino began as a low power wireless Arduino compatible development platform based on the popular ATmega328p chip used in the Arduino UNO. There are now several Moteino development boards including MoteinoMEGA based on the Atmega1284P and MoteinoM0 based on the SAMD21G18 Cortex M0+. For programming you will need an external FTDI-Adapter to load sketches, the advantages being lower cost, smaller size.

Servo Motor

A servo motor is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity and acceleration. It consists of a suitable motor coupled to a sensor for position feedback. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servo motors.

Servo motors have been around for a long time and are utilized in many applications. They are small in size but pack a big punch and are very energy-efficient. These features allow them to be used to operate remote-controlled or radio-controlled toy cars, robots and airplanes. Servo motors are also used in industrial applications, robotics, in-line manufacturing, pharmaceutics and food services.

Pololu Adjustable Boost Regulator 2.5-9.5 Volt

This powerful, adjustable boost regulator can generate an output voltage as high as 9.5 Volt from an input voltage as low as 1.5 Volt, all in a compact. A trimmer potentiometer lets you set the boost regulator’s output voltage to a value between 2.5 and 9.5 Volt.

DL2310Mk03

2 x Moteino R2 (Transceiver RFM12B)
1 x Pololu Adjustable Boost Regulator 2.5-9.5V
2 x Lithium Ion Battery – 1Ah
1 x Sub-Micro Servo 3.7g
1 x LED Green
1 x Tactile Button
1 x Resistor 10K Ohm
1 x SparkFun FTDI Basic Breakout – 5V
1 x SparkFun Cerberus USB Cable

Moteino R2 (Send)

TR0 – Digital 2
TBI – Digital 6
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
VIN – +5V
VIN – +3.3V
GND – GND

——

DL2310Mk03ps.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #8: Servo - Radio Frequency - Mk02
6-02
Send
DL2310Mk03ps.ino
2 x Moteino R2 (Transceiver RFM12B)
1 x Pololu Adjustable Boost Regulator 2.5-9.5V
2 x Lithium Ion Battery - 1Ah
1 x Sub-Micro Servo 3.7g
1 x LED Green
1 x Tactile Button
1 x Resistor 10K Ohm
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 = 50;
// Input
char input = 0;

// Need an instance of the RFM12B Radio Module
RFM12B radio;
// Send Size
byte sendSize = 0;
// Payload
char payload[100];
// Request ACK
bool requestACK = false;

// LED
int iLED = 9;

// The number of the Tactile Button pin
int iTButton = 6;
// Variable for reading the button status
int TButtonState = 0;
// The previous reading from the input pin
int lastTButtonState = LOW;
// The following variables are unsigned longs 
// because the time, measured in
// milliseconds, will quickly become a bigger 
// number than can be stored in an int.
// The last time the output pin was toggled
unsigned long lastDebounceTime = 0;
// The debounce time; increase if the output flickers
unsigned long debounceDelay = 50;

// String
String zzzzzz = "";
int iSER = 0;

// Software Version Information
String sver = "8-02";

void loop()
{

  // Tactile Button
  isTButton();
  
  // 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(){

  // zzzzzz ""
  zzzzzz = "";
  
  // zzzzz = "<SER|" + iSER + "|*";
  zzzzzz = "<SER|";
  zzzzzz = zzzzzz + iSER;
  zzzzzz = zzzzzz + "|*";
  
  // sendSize Length
  sendSize = zzzzzz.length();

  // sendSize
  payload[sendSize];

  // sendSize, charAt
  for(byte i = 0; i < sendSize+1; i++){

    payload[i] = zzzzzz.charAt(i);
    
  }
    
  // payload
  Serial.print(payload);
  
  // Request ACK
  requestACK = sendSize;
  
  // Wakeup
  radio.Wakeup();
  
  // Turn the LED on HIGH
  digitalWrite( iLED , HIGH);
  
  // Send
  radio.Send(GATEWAYID, payload, sendSize, 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();

  // 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;
  
}

getTButton.ino

// Tactile Button
void isTButton(){

  // Read the state of the Button value:
  int reading = digitalRead(iTButton);

  // Check to see if you just pressed the TButton
  // (i.e. the input went from LOW to HIGH), and you've waited long enough
  // since the last press to ignore any noise:

  // If the TButton changed, due to noise or pressing:
  if (reading != lastTButtonState) {
    
    // Reset the debouncing timer
    lastDebounceTime = millis();
    
  }

  if ((millis() - lastDebounceTime) > debounceDelay) {
    
    // Whatever the reading is at, it's been there for 
    // longer than the debounce
    // delay, so take it as the actual current state:

    // if the button state has changed:
    if (reading != TButtonState) {
      
      TButtonState = reading;

      // Check if the TButton is pressed. If it is, the TButtonState is HIGH:
      if (TButtonState == HIGH) {

        iSER = 1;

      } else {

        iSER = 0;
    
      }

      
      
    }
  }
  
  // Save the reading. Next time through the loop, 
  // it'll be the lastTButtonState:
  lastTButtonState = reading;
  
}

setup.ino

// Setup
void setup(){

  // Serial
  Serial.begin(SERIAL_BAUD);

  // LED
  pinMode( iLED , OUTPUT);

  // Initialize the Button pin as an input
  pinMode(iTButton, INPUT);

  // Setup 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 – +5V
VIN – +3.3V
GND – GND

DL2310Mk03Mkpr.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #8: Servo - Radio Frequency - Mk02
6-02
Receive
DL2310Mk03pr.ino
2 x Moteino R2 (RFM12B)
1 x Pololu Adjustable Boost Regulator 2.5-9.5V
2 x Lithium Ion Battery - 1Ah
1 x Sub-Micro Servo 3.7g
1 x LED Green
1 x Tactile Button
1 x Resistor 10K Ohm
1 x SparkFun FTDI Basic Breakout - 5V
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// RFM12B Radio
#include <RFM12B.h>
// Servo
#include <Servo.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;

// Message
String msg = "";

// Servo
int iSER = 0;
String sSER = "";
int firstClosingBracket = 0;

// LED
int iLED = 9;
int iLEDG = 7;

// Servo control
Servo serv;
const int pinServo = 6;

// Software Version Information
String sver = "8-02";

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("] ");

      // Message
      msg = "";
      
      // 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]);
        msg = msg + (char)radio.Data[i];
        
      }

      // Turn the LED on HIGH
      digitalWrite( iLED , HIGH);

      // Servo
      isServo();
  
      // 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();

  } 
  
}

getServo.ino

// Servo
void isServo(){

  // Message
  //Serial.println( msg );
  // msg = "<SER|0|*";
  firstClosingBracket = 0;
  // "<SER|"
  firstClosingBracket = msg.indexOf('|');
  //Serial.println( msg );
  msg.remove(0, 5);
  //Serial.println( msg );
  // Servo
  firstClosingBracket = msg.indexOf('|');     
  sSER = msg;
  sSER.remove(firstClosingBracket);
  //Serial.println( sSER );
  iSER = sSER.toInt();
  //Serial.println( iSER );
  int x = iSER;

  if (x == 1) {

    digitalWrite(iLEDG, HIGH);
    // Set servo to unlock
    serv.write( 0 );
    delay(15);
    
  } else {

    digitalWrite(iLEDG, LOW);
    // Set servo to lock
    serv.write( 90 );
    delay(15);
    
  }

}

setup.ino

// Setup
void setup()
{

  // Serial
  Serial.begin(SERIAL_BAUD);

  // LED
  pinMode( iLED , OUTPUT);
  pinMode( iLEDG , OUTPUT);

  // Attach Servo
  serv.attach( pinServo );

  // RFM12B Radio
  isSetupRFM12BRadio();

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Teacher, Instructor, E-Mentor, R&D and Consulting

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

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/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #26 – Radio Frequency – Bluetooth Moteino – Mk18

——

#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #Accelerometer #Magnetometer #Gyroscope #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Bluetooth Moteino

——

Bluetooth Moteino

——

Bluetooth Moteino

——

Moteino

Moteino began as a low power wireless Arduino compatible development platform based on the popular ATmega328p chip used in the Arduino UNO. Moteinos are compatible and can communicate with any other Arduino or development platform that uses the popular HopeRF RFM69 or LoRa transceivers, or even the older RFM12B. Moteino also comes with an optional SPI flash memory chip for wireless programming, or data logging. Moteino was designed to be a compact, highly customizable and affordable development platform, suitable for IoT, home automation and long range wireless projects.

Moteino in RFM12B to rebuild suggests doing as new without completely replacing. I decided to stripped down at RFM12B and rebuild in Bluetooth.

DL2306Mk05

1 x Moteino
1 x SparkFun Bluetooth Mate Silver
1 x SparkFun 9 Degrees of Freedom Breakout – MPU-9150
1 x LED Red
1 x SparkFun FTDI Basic Breakout – 5V
1 x SparkFun Cerberus USB Cable

Moteino

LED – Digital 8
RX – Digital 3
TX – Digital 2
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND

——

DL2306Mk05p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Bluetooth Moteino - Mk18
26-18
DL2306Mk05p.ino
1 x Moteino
1 x SparkFun Bluetooth Mate Silver
1 x SparkFun 9 Degrees of Freedom Breakout - MPU-9150
1 x LED Red
1 x SparkFun FTDI Basic Breakout - 5V
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// Software Serial
#include <SoftwareSerial.h>
// Two Wire Interface (TWI/I2C)
#include <Wire.h>
// I2CDev I2C utilities
#include "I2Cdev.h"
// MPU9150Lib 9-axis fusion
#include "MPU9150Lib.h"
// CalLib magnetometer and accelerometer calibration
#include "CalLib.h"
// Motion Driver InvenSense Embedded SDK v5.1
#include <dmpKey.h>
#include <dmpmap.h>
#include <inv_mpu.h>
#include <inv_mpu_dmp_motion_driver.h>
// EEPROM Magnetometer and Accelerometer data is stored
#include <EEPROM.h>

// the MPU object
MPU9150Lib MPU;
//  MPU_UPDATE_RATE defines the rate (in Hz)
// at which the MPU updates the sensor data and DMP output
#define MPU_UPDATE_RATE  (20)
//  MAG_UPDATE_RATE defines the rate (in Hz) at which the
// MPU updates the magnetometer data
//  MAG_UPDATE_RATE should be less than or equal to the MPU_UPDATE_RATE
#define MAG_UPDATE_RATE  (10)
//  MPU_MAG_MIX defines the influence that the magnetometer has on the yaw output.
//  The magnetometer itself is quite noisy so some mixing with the gyro yaw can help
//  significantly. Some example values are defined below:
// Just use gyro yaw
#define  MPU_MAG_MIX_GYRO_ONLY          0
// Just use magnetometer and no gyro yaw
#define  MPU_MAG_MIX_MAG_ONLY           1
// A good mix value 
#define  MPU_MAG_MIX_GYRO_AND_MAG       10
// mainly gyros with a bit of mag correction
#define  MPU_MAG_MIX_GYRO_AND_SOME_MAG  50
//  MPU_LPF_RATE is the low pas filter rate and can be between 5 and 188Hz
#define MPU_LPF_RATE   5

// This is our earth frame gravity vector - quaternions and vectors
MPUQuaternion gravity;

// Quaternion Result
float Quaternion_X = 0.0;
float Quaternion_Y = 0.0;
float Quaternion_Z = 0.0;

//  SERIAL_PORT_SPEED defines the speed to use for the debug serial port
#define  SERIAL_PORT_SPEED  115200

// Software Serial
// TX-O pin of bluetooth mate, Arduino D2
int bluetoothTx = 2;
// RX-I pin of bluetooth mate, Arduino D3
int bluetoothRx = 3;
// Bluetooth
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
// BTA
String BTA = "0006664FAE18";

// LED Red
int iLedRed = 8;

// Variable to calculate frequency
unsigned long curr = 0;
unsigned long last = 0;
unsigned long freq;

// Software Version Information
String sver = "26-18";

void loop() {
  
  // MPU
  isMPU();

}

getMPU.ino

// MPU
// Setup MPU
void isSetupMPU() {

  // MPU
  MPU.init(MPU_UPDATE_RATE, MPU_MAG_MIX_GYRO_AND_MAG, MAG_UPDATE_RATE, MPU_LPF_RATE);     // start the MPU

  // Set up the initial gravity vector for quaternion rotation
  // Max value down the z axis
  gravity[QUAT_W] = 0;
  gravity[QUAT_X] = 0;
  gravity[QUAT_Y] = 0;
  gravity[QUAT_Z] = SENSOR_RANGE;
  
}
// MPU
void isMPU() {

  // Quaternion
  // This is our body frame gravity vector
  MPUQuaternion rotatedGravity;
  // This is the conjugate of the fused quaternion
  MPUQuaternion fusedConjugate;
  // Used in the rotation
  MPUQuaternion qTemp;
  // The accelerations
  MPUVector3 result;

  // Get the latest data
  if (MPU.read()) {
    
    // Need this for the rotation
    MPUQuaternionConjugate(MPU.m_fusedQuaternion, fusedConjugate);
    
    // Rotate the gravity vector into the body frame
    MPUQuaternionMultiply(gravity, MPU.m_fusedQuaternion, qTemp);
    MPUQuaternionMultiply(fusedConjugate, qTemp, rotatedGravity);
    
    // Now subtract rotated gravity from the body accels to get real accelerations.
    // Note that signs are reversed to get +ve acceleration results
    // in the conventional axes.
    // Quaternion Result
    Quaternion_X = -(MPU.m_calAccel[VEC3_X] - rotatedGravity[QUAT_X]);
    Quaternion_Y = -(MPU.m_calAccel[VEC3_Y] - rotatedGravity[QUAT_Y]);
    Quaternion_Z = -(MPU.m_calAccel[VEC3_Z] - rotatedGravity[QUAT_Z]);

    // Variable to calculate frequency
    curr = micros();
    freq = curr - last;
    last = curr;
    // Bluetooth
    Serial.print( "Blue|" + BTA + "|" );
    Serial.print( Quaternion_X );
    Serial.print( "|" );
    Serial.print( Quaternion_Y );
    Serial.print( "|" );
    Serial.print( Quaternion_Z );
    Serial.print( "|" );
    Serial.print( freq );
    Serial.println( "|*" );
    // Send any characters the Serial monitor prints to the bluetooth
    bluetooth.print((char)Serial.read());
   
  }

}

setup.ino

// Setup
void setup()
{
  
  // Serial
  Serial.begin(SERIAL_PORT_SPEED);

  // Bluetooth
  // The Bluetooth Mate defaults to 115200bps
  bluetooth.begin(115200);

  // LED Red
  pinMode(iLedRed, OUTPUT);
  digitalWrite(iLedRed, HIGH);
  
  // Give display time to power on
  delay(100);

  // Wire communicate with I2C / TWI devices
  Wire.begin();

  // Pause
  delay(50);

  // Setup MPU
  isSetupMPU();

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Programming Language
  • 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

  • Programming Language
  • 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/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #26 – Radio Frequency – GPS Receiver – Mk07

——

#DonLucElectronics #DonLuc #RadioFrequency #Moteino #Send #Receive #GPSReceiver #OpenLog #Display #FreeIMU #Magnetometer #Accelerometer #Gyroscope #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

GPS Receiver

——

GPS Receiver

——

GPS Receiver

——

GPS Receiver – GP-20U7 (56 Channel)

The GP-20U7 is a compact GPS receiver with a built-in high performances all-in-one GPS chipset. The GP-20U7 accurately provides position, velocity, and time readings as well possessing high sensitivity and tracking capabilities. Thanks to the low power consumption this receiver requires, the GP-20U7 is ideal for portable applications such as tablet PCs, smart phones, and other devices requiring positioning capability.

This 56-channel GPS module, that supports a standard NMEA-0183 and uBlox 7 protocol, has low power consumption of 40mA@3.3V (Max), an antenna on board, and -162dBm tracking sensitivity. With 56 channels in search mode and 22 channels “All-In-View” tracking, the GP-20U7 is quite the work horse for its size.

DL2212Mk02

2 x Moteino R2 (RFM12B)
1 x GPS Receiver – GP-20U7 (56 Channel)
1 x SparkFun OpenLog
1 x microSD Card – 16GB
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x SparkFun 9 Degrees of Freedom – Sensor Stick
2 x Lithium Ion Battery – 1 Ah
1 x SparkFun Cerberus USB Cable

Moteino R2 (Receive)

TX0 – Digital 1
TR0 – Digital 2
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND

——

DL2212Mk02pr.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - GPS Receiver - Mk07
26-07
Receive
DL2212Mk02pr.ino
2 x Moteino R2 (RFM12B)
1 x GPS Receiver - GP-20U7 (56 Channel)
1 x SparkFun OpenLog
1 x microSD Card - 16GB
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x SparkFun 9 Degrees of Freedom - Sensor Stick
2 x Lithium Ion Battery - 1Ah
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// RFM12B Radio
#include <RFM12B.h>
// Two Wire Interface (TWI/I2C)
#include <Wire.h>
// SparkFun Micro OLED
#include <SFE_MicroOLED.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;

// Process Message
// Message
String msg = "";
int firstClosingBracket = 0;
// Yaw Pitch Roll
String sYaw = "";
String sPitch = "";
String sRoll = "";
float Yaw = 0;
float Pitch = 0;
float Roll = 0;

// LED
int iLED = 9;

// SparkFun Micro OLED
#define PIN_RESET 9
#define DC_JUMPER 1
// I2C declaration
MicroOLED oled(PIN_RESET, DC_JUMPER);

// Software Version Information
String sver = "26-07";

void loop() {

  // is RFM12B Radio
  isRFM12BRadio();

  // Micro OLED
  isMicroOLED();

}

getFreeIMU.ino

// FreeIMU
// isFreeIMU
void isFreeIMU(){

  // FreeIMU
  // msg = "<IMU|Yaw|Pitch|Roll|GPS Status|Latitude|Longitude|Date|Time|*"
  // msg = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|" + GPSSt 
  // + "|" + TargetLat + "|" TargetLon + "|" + TargetDat +"|" + TargetTim + "|*"
  firstClosingBracket = 0;
  // "<IMU|"
  firstClosingBracket = msg.indexOf('|');
  msg.remove(0, 5);
  // Yaw
  firstClosingBracket = msg.indexOf('|');
  sYaw = msg;
  sYaw.remove(firstClosingBracket);
  Yaw = sYaw.toFloat();
  // Pitch
  firstClosingBracket = firstClosingBracket + 1;
  msg.remove(0, firstClosingBracket );  
  firstClosingBracket = msg.indexOf('|');
  sPitch = msg;
  sPitch.remove(firstClosingBracket);
  Pitch = sPitch.toFloat();
  // Roll
  firstClosingBracket = firstClosingBracket + 1;
  msg.remove(0, firstClosingBracket );  
  firstClosingBracket = msg.indexOf('|');
  sRoll = msg;
  sRoll.remove(firstClosingBracket);
  Roll = sRoll.toFloat();

}

getMicroOLED.ino

// SparkFun Micro OLED
// Setup Micro OLED
void isSetupMicroOLED() {

  // Initialize the OLED
  oled.begin();
  // Clear the display's internal memory
  oled.clear(ALL);
  // Display what's in the buffer (splashscreen)
  oled.display();

  // Delay 1000 ms
  delay(1000);

  // Clear the buffer.
  oled.clear(PAGE);
  
}
// Micro OLED
void isMicroOLED() {

  // Text Display FreeIMU
  // Clear the display
  oled.clear(PAGE);
  // Set cursor to top-left
  oled.setCursor(0, 0);
  // Set font to type 0
  oled.setFontType(0);
  // FreeIMU
  oled.print("FreeIMU");
  oled.setCursor(0, 12);
  // Yaw
  oled.print("Y: ");
  oled.print(Yaw);
  oled.setCursor(0, 25);
  // Pitch
  oled.print("P: ");
  oled.print(Pitch);
  oled.setCursor(0, 39);
  // Roll
  oled.print("R: ");
  oled.print(Roll);
  oled.display();

}

getRFM12BRadio.ino

// RFM12B Radio
void isSetupRFM12BRadio()
{

  // RFM12B Radio
  radio.Initialize(NODEID, RF12_433MHZ, NETWORKID);
  // Encryption
  radio.Encrypt(KEY);
  // Transmitting
 
}
// is RFM12 BRadio
void isRFM12BRadio()
{

  // Receive
  if (radio.ReceiveComplete())
  {
    
    // CRC Pass
    if (radio.CRCPass())
    {
        
      // Message
      msg = "";
      
      // 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]);
        msg = msg + (char)radio.Data[i];
        
      }
      
      // Serial
      Serial.println( msg );
      
      // Turn the LED on HIGH
      digitalWrite( iLED , HIGH);
      
      // FreeIMU
      // Yaw Pitch Roll
      isFreeIMU();

      // ACK Requested
      if (radio.ACKRequested())
      {
        
        // Send ACK
        radio.SendACK();
        
      }

      // Turn the LED on LOW
      digitalWrite( iLED , LOW);
    
    }
    else
    {
      
      // BAD-CRC

    }

  } 
  
}

setup.ino

// Setup
void setup()
{

  // Serial
  Serial.begin(SERIAL_BAUD);

  // Give display time to power on
  delay(100);
  
  // Set up I2C bus
  Wire.begin();

  // Setup Micro OLED
  isSetupMicroOLED();

  // LED
  pinMode( iLED , OUTPUT);

  // RFM12B Radio
  isSetupRFM12BRadio();

}

——

Moteino R2 (Send)

TR0 – Digital 2
GPT – Digital 3
GPR – Digital 4
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND

——

DL2212Mk02ps.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - GPS Receiver - Mk07
26-07
Send
DL2212Mk02ps.ino
2 x Moteino R2 (RFM12B)
1 x GPS Receiver - GP-20U7 (56 Channel)
1 x SparkFun OpenLog
1 x microSD Card - 16GB
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x SparkFun 9 Degrees of Freedom - Sensor Stick
2 x Lithium Ion Battery - 1Ah
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// RFM12B Radio
#include <RFM12B.h>
// Sleep
#include <avr/sleep.h>
// Two Wire Interface (TWI/I2C)
#include <Wire.h>
// Includes and variables for IMU integration
// Accelerometer
#include <ADXL345.h>
// Magnetometer
#include <HMC58X3.h>
// MEMS Gyroscope
#include <ITG3200.h>
// Debug
#include "DebugUtils.h"
// FreeIMU
#include <CommunicationUtils.h>
#include <FreeIMU.h>
// GPS Receiver
#include <TinyGPS++.h>
// Software Serial
#include <SoftwareSerial.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[100];
// Request ACK
bool requestACK = false;

// LED
int iLED = 9;

// Set the FreeIMU object
FreeIMU my3IMU = FreeIMU();

// Yaw Pitch Roll
String zzzzzz = "";
String sYaw = "";
String sPitch = "";
String sRoll = "";
float ypr[3];
float Yaw = 0;
float Pitch = 0;
float Roll = 0;

// GPS Receiver
#define gpsRXPIN 4
// This one is unused and doesnt have a conection
#define gpsTXPIN 3
// The TinyGPS++ object
TinyGPSPlus gps;
// Latitude
float TargetLat;
String sLat = "";
// Longitude
float TargetLon;
String sLon = "";
// GPS Date, Time
// GPS Date
String TargetDat;
// GPS Time
String TargetTim;
// GPS Status
String GPSSt = "";

// The serial connection to the GPS device
SoftwareSerial tGPS(gpsRXPIN, gpsTXPIN);

// Software Version Information
String sver = "26-07";

void loop()
{

  // isGPS
  isGPS();
  
  // isFreeIMU
  isFreeIMU();

  // is RFM12B Radio
  isRFM12BRadio();

  // Inter Packet Delay
  delay(interPacketDelay);
  
}

getFreeIMU.ino

// FreeIMU
// isFreeIMU
void isFreeIMU(){

  // FreeIMU
  // Yaw Pitch Roll
  my3IMU.getYawPitchRoll(ypr);
  // Yaw
  Yaw = ypr[0];
  // Pitch
  Pitch = ypr[1];
  // Roll
  Roll = ypr[2];

}

getGPS.ino

// GPS Receiver
// Setup GPS
void setupGPS() {

  // Setup GPS
  tGPS.begin( 9600 );
  
}
// isGPS
void isGPS(){

  // Receives NEMA data from GPS receiver
  // This sketch displays information every time a new sentence is correctly encoded
  while ( tGPS.available() > 0)
    
    if (gps.encode( tGPS.read() ))
    {
     
       // GPS Vector Pointer Target
       displayInfo();
       // GPS Date, Time
       displayDTS();
       
    }
  
  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
   
     while(true);
    
  }

}
// GPS Vector Pointer Target
void displayInfo(){

  // Location
  if (gps.location.isValid())
  {
    
     // Latitude
     TargetLat = gps.location.lat();
     // Longitude
     TargetLon = gps.location.lng();
     // GPS Status 2
     GPSSt = "Yes";
    
  }
  else
  {

     // GPS Status 0
     GPSSt = "No";
    
  }

}
// GPS Date, Time
void displayDTS(){

  // Date
  TargetDat = ""; 
  if (gps.date.isValid())
  {
    
     // Date
     // Year
     TargetDat += String(gps.date.year(), DEC);
     TargetDat += "/";
     // Month
     TargetDat += String(gps.date.month(), DEC);
     TargetDat += "/";
     // Day
     TargetDat += String(gps.date.day(), DEC);
    
  }

  // Time
  TargetTim = "";
  if (gps.time.isValid())
  {
    
     // Time
     // Hour
     TargetTim += String(gps.time.hour(), DEC);
     TargetTim += ":";
     // Minute
     TargetTim += String(gps.time.minute(), DEC);
     TargetTim += ":";
     // Secound
     TargetTim += String(gps.time.second(), DEC);
    
  }

}

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(){

  // sYaw, sPitch, sRoll ""
  sYaw = "";
  sPitch = "";
  sRoll = "";
  // Latitude and Longitude
  sLat = "";
  sLon = "";
  
  // sYaw, sPitch, sRoll concat
  sYaw.concat(Yaw);
  sPitch.concat(Pitch);
  sRoll.concat(Roll);

  // Latitude and Longitude
  sLat.concat( TargetLat );
  sLon.concat( TargetLon );

  // zzzzzz ""
  zzzzzz = "";

  // zzzzzz = "<IMU|Yaw|Pitch|Roll|GPS Status|Latitude|Longitude|Date|Time|*"
  // zzzzzz = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|" + GPSSt 
  // + "|" + TargetLat + "|" TargetLon + "|" + TargetDat +"|" + TargetTim + "|*"
  zzzzzz = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|" + GPSSt + "|" 
  + sLat + "|" + sLon + "|" + TargetDat + "|" + TargetTim + "|*";

  // sendSize Length
  sendSize = zzzzzz.length();

  // sendSize
  payload[sendSize];

  // sendSize, charAt
  for(byte i = 0; i < sendSize+1; i++){

    payload[i] = zzzzzz.charAt(i);
    
  }
    
  // payload
  Serial.print(payload);
  
  // Request ACK
  requestACK = sendSize;
  
  // Wakeup
  radio.Wakeup();
  
  // Turn the LED on HIGH
  digitalWrite( iLED , HIGH);
  
  // Send
  radio.Send(GATEWAYID, payload, sendSize, 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();

  // 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);

  // GPS Receiver
  // Setup GPS
  setupGPS();

  // LED
  pinMode( iLED , OUTPUT);

  // Set up I2C bus
  Wire.begin();

  // RFM12B Radio
  isSetupRFM12BRadio();

  // Pause
  delay(5);
  // Initialize IMU
  my3IMU.init();
  // Pause
  delay(5);

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Programming Language
  • 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

  • Programming Language
  • 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/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #26 – Radio Frequency – OpenLog – Mk06

——

#DonLucElectronics #DonLuc #RadioFrequency #Moteino #Send #Receive #OpenLog #Display #FreeIMU #Magnetometer #Accelerometer #Gyroscope #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

OpenLog

——

OpenLog

——

OpenLog

——

SparkFun OpenLog

The SparkFun OpenLog is an open source data logger that works over a simple serial connection and supports microSD cards up to 32GB. The OpenLog can store or “Log” huge amounts of serial data and act as a black box of sorts to store all the serial data that your project generates, for scientific or debugging purposes.

The SparkFun OpenLog uses an ATmega328 running at 16MHz thanks to the onboard resonator. The OpenLog draws approximately 2-3mA in idle mode. During a full record OpenLog can draw 10 to 20mA depending on the microSD card being used.

All data logged by the OpenLog is stored on the microSD card. Any 512MB to 32GB microSD card should work. OpenLog supports both FAT16 and FAT32 SD formats.

DL2212Mk01

2 x Moteino R2 (RFM12B)
1 x SparkFun OpenLog
1 x microSD Card – 16GB
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x SparkFun 9 Degrees of Freedom – Sensor Stick
2 x Lithium Ion Battery – 1 Ah
1 x SparkFun Cerberus USB Cable

Moteino R2 (Receive)

TX0 – Digital 1
TR0 – Digital 2
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND

——

DL2212Mk01pr.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - OpenLog - Mk06
26-06
Receive
DL2212Mk01pr.ino
2 x Moteino R2 (RFM12B)
1 x SparkFun OpenLog
1 x microSD Card - 16GB
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x SparkFun 9 Degrees of Freedom - Sensor Stick
2 x Lithium Ion Battery - 1Ah
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// RFM12B Radio
#include <RFM12B.h>
// Two Wire Interface (TWI/I2C)
#include <Wire.h>
// SparkFun Micro OLED
#include <SFE_MicroOLED.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;

// Process Message
// Message
String msg = "";
int firstClosingBracket = 0;
// Yaw Pitch Roll
String sYaw = "";
String sPitch = "";
String sRoll = "";
float Yaw = 0;
float Pitch = 0;
float Roll = 0;

// LED
int iLED = 9;

// SparkFun Micro OLED
#define PIN_RESET 9
#define DC_JUMPER 1
// I2C declaration
MicroOLED oled(PIN_RESET, DC_JUMPER);

// Software Version Information
String sver = "26-06";

void loop() {

  // is RFM12B Radio
  isRFM12BRadio();

  // Micro OLED
  isMicroOLED();

}

getFreeIMU.ino

// FreeIMU
// isFreeIMU
void isFreeIMU(){

  // FreeIMU
  // IMU Yaw Pitch Roll
  // msg = "<IMU|1000|1000|1000|*";
  // msg = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|*"
  firstClosingBracket = 0;
  // "<IMU|"
  firstClosingBracket = msg.indexOf('|');
  msg.remove(0, 5);
  // Yaw
  firstClosingBracket = msg.indexOf('|');
  sYaw = msg;
  sYaw.remove(firstClosingBracket);
  Yaw = sYaw.toFloat();
  // Pitch
  firstClosingBracket = firstClosingBracket + 1;
  msg.remove(0, firstClosingBracket );  
  firstClosingBracket = msg.indexOf('|');
  sPitch = msg;
  sPitch.remove(firstClosingBracket);
  Pitch = sPitch.toFloat();
  // Roll
  firstClosingBracket = firstClosingBracket + 1;
  msg.remove(0, firstClosingBracket );  
  firstClosingBracket = msg.indexOf('|');
  sRoll = msg;
  sRoll.remove(firstClosingBracket);
  Roll = sRoll.toFloat();

}

getMicroOLED.ino

// SparkFun Micro OLED
// Setup Micro OLED
void isSetupMicroOLED() {

  // Initialize the OLED
  oled.begin();
  // Clear the display's internal memory
  oled.clear(ALL);
  // Display what's in the buffer (splashscreen)
  oled.display();

  // Delay 1000 ms
  delay(1000);

  // Clear the buffer.
  oled.clear(PAGE);
  
}
// Micro OLED
void isMicroOLED() {

  // Text Display FreeIMU
  // Clear the display
  oled.clear(PAGE);
  // Set cursor to top-left
  oled.setCursor(0, 0);
  // Set font to type 0
  oled.setFontType(0);
  // FreeIMU
  oled.print("FreeIMU");
  oled.setCursor(0, 12);
  // Yaw
  oled.print("Y: ");
  oled.print(Yaw);
  oled.setCursor(0, 25);
  // Pitch
  oled.print("P: ");
  oled.print(Pitch);
  oled.setCursor(0, 39);
  // Roll
  oled.print("R: ");
  oled.print(Roll);
  oled.display();

}

getRFM12BRadio.ino

// RFM12B Radio
void isSetupRFM12BRadio()
{

  // RFM12B Radio
  radio.Initialize(NODEID, RF12_433MHZ, NETWORKID);
  // Encryption
  radio.Encrypt(KEY);
  // Transmitting
 
}
// is RFM12 BRadio
void isRFM12BRadio()
{

  // Receive
  if (radio.ReceiveComplete())
  {
    
    // CRC Pass
    if (radio.CRCPass())
    {
        
      // Message
      msg = "";
      
      // 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]);
        msg = msg + (char)radio.Data[i];
        
      }
      
      // Serial
      Serial.println( msg );
      
      // Turn the LED on HIGH
      digitalWrite( iLED , HIGH);
      
      // FreeIMU
      // Yaw Pitch Roll
      isFreeIMU();
  
      // ACK Requested
      if (radio.ACKRequested())
      {
        
        // Send ACK
        radio.SendACK();
        
      }

      // Turn the LED on LOW
      digitalWrite( iLED , LOW);
    
    }
    else
    {
      
      // BAD-CRC

    }

  } 
  
}

setup.ino

// Setup
void setup()
{

  // Serial
  Serial.begin(SERIAL_BAUD);

  // Give display time to power on
  delay(100);
  
  // Set up I2C bus
  Wire.begin();

  // Setup Micro OLED
  isSetupMicroOLED();

  // LED
  pinMode( iLED , OUTPUT);

  // RFM12B Radio
  isSetupRFM12BRadio();

}

——

Moteino R2 (Send)

TR0 – Digital 2
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND

——

DL2212Mk01ps.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - OpenLog - Mk06
26-06
Send
DL2212Mk01ps.ino
2 x Moteino R2 (RFM12B)
1 x SparkFun OpenLog
1 x microSD Card - 16GB
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x SparkFun 9 Degrees of Freedom - Sensor Stick
2 x Lithium Ion Battery - 1Ah
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// RFM12B Radio
#include <RFM12B.h>
// Sleep
#include <avr/sleep.h>
// Two Wire Interface (TWI/I2C)
#include <Wire.h>
// Includes and variables for IMU integration
// Accelerometer
#include <ADXL345.h>
// Magnetometer
#include <HMC58X3.h>
// MEMS Gyroscope
#include <ITG3200.h>
// Debug
#include "DebugUtils.h"
// FreeIMU
#include <CommunicationUtils.h>
#include <FreeIMU.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[100];
// Request ACK
bool requestACK = false;

// LED
int iLED = 9;

// Set the FreeIMU object
FreeIMU my3IMU = FreeIMU();

// Yaw Pitch Roll
String zzzzzz = "";
String sYaw = "";
String sPitch = "";
String sRoll = "";
float ypr[3];
float Yaw = 0;
float Pitch = 0;
float Roll = 0;

// Software Version Information
String sver = "26-06";

void loop()
{

  // isFreeIMU
  isFreeIMU();

  // is RFM12B Radio
  isRFM12BRadio();

  // Inter Packet Delay
  delay(interPacketDelay);
  
}

getFreeIMU.ino

// FreeIMU
// isFreeIMU
void isFreeIMU(){

  // FreeIMU
  // Yaw Pitch Roll
  my3IMU.getYawPitchRoll(ypr);
  // Yaw
  Yaw = ypr[0];
  // Pitch
  Pitch = ypr[1];
  // Roll
  Roll = ypr[2];

}

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(){

  // sYaw, sPitch, sRoll ""
  sYaw = "";
  sPitch = "";
  sRoll = "";

  // sYaw, sPitch, sRoll concat
  sYaw.concat(Yaw);
  sPitch.concat(Pitch);
  sRoll.concat(Roll);

  // zzzzzz ""
  zzzzzz = "";

  // zzzzzz = "<IMU|1000|1000|1000|*";
  // zzzzzz = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|*"
  zzzzzz = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|*";

  // sendSize Length
  sendSize = zzzzzz.length();

  // sendSize
  payload[sendSize];

  // sendSize, charAt
  for(byte i = 0; i < sendSize+1; i++){

    payload[i] = zzzzzz.charAt(i);
    
  }
    
  // payload
  Serial.print(payload);
  
  // Request ACK
  requestACK = sendSize;
  
  // Wakeup
  radio.Wakeup();
  
  // Turn the LED on HIGH
  digitalWrite( iLED , HIGH);
  
  // Send
  radio.Send(GATEWAYID, payload, sendSize, 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();

  // 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);

  // Set up I2C bus
  Wire.begin();

  // RFM12B Radio
  isSetupRFM12BRadio();

  // Pause
  delay(5);
  // Initialize IMU
  my3IMU.init();
  // Pause
  delay(5);

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Programming Language
  • 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

  • Programming Language
  • 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/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #26 – Radio Frequency – Display – Mk05

——

#DonLucElectronics #DonLuc #RadioFrequency #Moteino #Send #Receive #Display #FreeIMU #Magnetometer #Accelerometer #Gyroscope #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Display

——

Display

——

Display

——

SparkFun Micro OLED Breakout

The SparkFun Qwiic Micro OLED Breakout is a Qwiic-enabled version of our popular Micro OLED display. The small monochrome, blue-on-black OLED screen presents incredibly clear images for your viewing pleasure. It’s the OLED display is crisp, and you can fit a deceivingly large amount of graphics on there. This breakout is perfect for adding graphics to your next project and displaying diagnostic information without resorting to a serial output, all with the ease of use of our own Qwiic Connect System.

This version of the Micro OLED Breakout is exactly the size of its non-Qwiic sibling, featuring a screen that is 64 pixels wide and 48 pixels tall and measuring 0.66″ across. But it has also been equipped with two Qwiic connectors, making it ideal for I2C operations. We’ve also added two mounting holes and a convenient Qwiic cable holder incorporated into a detachable tab on the board that can be easily removed thanks to a v-scored edge.

DL2211Mk09

2 x Moteino R2 (RFM12B)
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x SparkFun 9 Degrees of Freedom – Sensor Stick
2 x Lithium Ion Battery – 1 Ah
1 x SparkFun Cerberus USB Cable

Moteino R2 (Receive)

TR0 – Digital 2
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND

——

DL2211Mk09pr.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Display - Mk05
26-05
Receive
DL2211Mk09pr.ino
2 x Moteino R2 (RFM12B)
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x SparkFun 9 Degrees of Freedom - Sensor Stick
2 x Lithium Ion Battery - 1Ah
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// RFM12B Radio
#include <RFM12B.h>
// Two Wire Interface (TWI/I2C)
#include <Wire.h>
// SparkFun Micro OLED
#include <SFE_MicroOLED.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;

// Process Message
// Message
String msg = "";
int firstClosingBracket = 0;
// Yaw Pitch Roll
String sYaw = "";
String sPitch = "";
String sRoll = "";
float Yaw = 0;
float Pitch = 0;
float Roll = 0;

// LED
int iLED = 9;

// SparkFun Micro OLED
#define PIN_RESET 9
#define DC_JUMPER 1
// I2C declaration
MicroOLED oled(PIN_RESET, DC_JUMPER);

// Software Version Information
String sver = "26-05";

void loop() {

  // is RFM12B Radio
  isRFM12BRadio();

  // Micro OLED
  isMicroOLED();

}

getFreeIMU.ino

// FreeIMU
// isFreeIMU
void isFreeIMU(){

  // FreeIMU
  // IMU Yaw Pitch Roll
  // msg = "<IMU|1000|1000|1000|*";
  // msg = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|*"
  firstClosingBracket = 0;
  // "<IMU|"
  firstClosingBracket = msg.indexOf('|');
  msg.remove(0, 5);
  // Yaw
  firstClosingBracket = msg.indexOf('|');
  sYaw = msg;
  sYaw.remove(firstClosingBracket);
  Yaw = sYaw.toFloat();
  // Pitch
  firstClosingBracket = firstClosingBracket + 1;
  msg.remove(0, firstClosingBracket );  
  firstClosingBracket = msg.indexOf('|');
  sPitch = msg;
  sPitch.remove(firstClosingBracket);
  Pitch = sPitch.toFloat();
  // Roll
  firstClosingBracket = firstClosingBracket + 1;
  msg.remove(0, firstClosingBracket );  
  firstClosingBracket = msg.indexOf('|');
  sRoll = msg;
  sRoll.remove(firstClosingBracket);
  Roll = sRoll.toFloat();

}

getMicroOLED.ino

// SparkFun Micro OLED
// Setup Micro OLED
void isSetupMicroOLED() {

  // Initialize the OLED
  oled.begin();
  // Clear the display's internal memory
  oled.clear(ALL);
  // Display what's in the buffer (splashscreen)
  oled.display();

  // Delay 1000 ms
  delay(1000);

  // Clear the buffer.
  oled.clear(PAGE);
  
}
// Micro OLED
void isMicroOLED() {

  // Text Display FreeIMU
  // Clear the display
  oled.clear(PAGE);
  // Set cursor to top-left
  oled.setCursor(0, 0);
  // Set font to type 0
  oled.setFontType(0);
  // FreeIMU
  oled.print("FreeIMU");
  oled.setCursor(0, 12);
  // Yaw
  oled.print("Y: ");
  oled.print(Yaw);
  oled.setCursor(0, 25);
  // Pitch
  oled.print("P: ");
  oled.print(Pitch);
  oled.setCursor(0, 39);
  // Roll
  oled.print("R: ");
  oled.print(Roll);
  oled.display();

}

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("] ");
      
      // Message
      msg = "";
      
      // 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]);
        msg = msg + (char)radio.Data[i];
        
      }

      // Turn the LED on HIGH
      digitalWrite( iLED , HIGH);
      
      // FreeIMU
      // Yaw Pitch Roll
      isFreeIMU();
  
      // 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);

  // Give display time to power on
  delay(100);
  
  // Set up I2C bus
  Wire.begin();

  // Setup Micro OLED
  isSetupMicroOLED();

  // LED
  pinMode( iLED , OUTPUT);

  // RFM12B Radio
  isSetupRFM12BRadio();

}

——

Moteino R2 (Send)

TR0 – Digital 2
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND

——

DL2211Mk09ps.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Display - Mk05
26-05
Send
DL2211Mk09ps.ino
2 x Moteino R2 (RFM12B)
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x SparkFun 9 Degrees of Freedom - Sensor Stick
2 x Lithium Ion Battery - 1Ah
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// RFM12B Radio
#include <RFM12B.h>
// Sleep
#include <avr/sleep.h>
// Two Wire Interface (TWI/I2C)
#include <Wire.h>
// Includes and variables for IMU integration
// Accelerometer
#include <ADXL345.h>
// Magnetometer
#include <HMC58X3.h>
// MEMS Gyroscope
#include <ITG3200.h>
// Debug
#include "DebugUtils.h"
// FreeIMU
#include <CommunicationUtils.h>
#include <FreeIMU.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[100];
// Request ACK
bool requestACK = false;

// LED
int iLED = 9;

// Set the FreeIMU object
FreeIMU my3IMU = FreeIMU();

// Yaw Pitch Roll
String zzzzzz = "";
String sYaw = "";
String sPitch = "";
String sRoll = "";
float ypr[3];
float Yaw = 0;
float Pitch = 0;
float Roll = 0;

// Software Version Information
String sver = "26-05";

void loop()
{

  // isFreeIMU
  isFreeIMU();

  // is RFM12B Radio
  isRFM12BRadio();

  // Inter Packet Delay
  delay(interPacketDelay);
  
}

getFreeIMU.ino

// FreeIMU
// isFreeIMU
void isFreeIMU(){

  // FreeIMU
  // Yaw Pitch Roll
  my3IMU.getYawPitchRoll(ypr);
  // Yaw
  Yaw = ypr[0];
  // Pitch
  Pitch = ypr[1];
  // Roll
  Roll = ypr[2];

}

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(){

  // sYaw, sPitch, sRoll ""
  sYaw = "";
  sPitch = "";
  sRoll = "";

  // sYaw, sPitch, sRoll concat
  sYaw.concat(Yaw);
  sPitch.concat(Pitch);
  sRoll.concat(Roll);

  // zzzzzz ""
  zzzzzz = "";

  // zzzzzz = "<IMU|1000|1000|1000|*";
  // zzzzzz = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|*"
  zzzzzz = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|*";

  // sendSize Length
  sendSize = zzzzzz.length();

  // sendSize
  payload[sendSize];

  // sendSize, charAt
  for(byte i = 0; i < sendSize+1; i++){

    payload[i] = zzzzzz.charAt(i);
    
  }
    
  // payload
  Serial.print(payload);
  
  // Request ACK
  requestACK = sendSize;
  
  // Wakeup
  radio.Wakeup();
  
  // Turn the LED on HIGH
  digitalWrite( iLED , HIGH);
  
  // Send
  radio.Send(GATEWAYID, payload, sendSize, 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();

  // 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);

  // Set up I2C bus
  Wire.begin();

  // RFM12B Radio
  isSetupRFM12BRadio();

  // Pause
  delay(5);
  // Initialize IMU
  my3IMU.init();
  // Pause
  delay(5);

}

——

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

Project #26 – Radio Frequency – FreeIMU – Mk04

——

#DonLucElectronics #DonLuc #RadioFrequency #Moteino #Send #Receive #FreeIMU #Magnetometer #Accelerometer #Gyroscope #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

FreeIMU

——

FreeIMU

——

FreeIMU

——

FreeIMU

Orientation and Motion Sensing are widely implemented on various consumer products, such as mobile phones, tablets and cameras as they enable immediate interaction with virtual information. The prototyping phase of any orientation and motion sensing capable device is however a quite difficult process as it may involve complex hardware designing, math algorithms and programming. FreeIMU, an Open Hardware Framework for prototyping orientation and motion sensing capable devices. The framework consists in a small circuit board containing various sensors and a software library, built on top of the Arduino platform. Both the hardware and library are released under open licences and supported by an active community allowing to be implemented into research and commercial projects.

DL2211Mk08

2 x Moteino R2 (RFM12B)
1 x SparkFun 9 Degrees of Freedom – Sensor Stick
1 x Lithium Ion Battery – 1 Ah
1 x SparkFun FTDI Basic Breakout – 5V
1 x SparkFun Cerberus USB Cable

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

——

DL2211Mk08pr.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - FreeIMU - Mk04
26-04
Receive
DL2211Mk08pr.ino
2 x Moteino R2 (RFM12B)
1 x SparkFun 9 Degrees of Freedom - Sensor Stick
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-04";

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();

}

Moteino R2 (Send)

TR0 – Digital 2
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND

——

DL2211Mk08ps.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - FreeIMU - Mk04
26-04
Send
DL2211Mk08ps.ino
2 x Moteino R2 (RFM12B)
1 x SparkFun 9 Degrees of Freedom - Sensor Stick
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>
// Two Wire Interface (TWI/I2C)
#include <Wire.h>
// Includes and variables for IMU integration
// Accelerometer
#include <ADXL345.h>
// Magnetometer
#include <HMC58X3.h>
// MEMS Gyroscope
#include <ITG3200.h>
// Debug
#include "DebugUtils.h"
// FreeIMU
#include <CommunicationUtils.h>
#include <FreeIMU.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[100];
// Request ACK
bool requestACK = false;

// LED
int iLED = 9;

// Set the FreeIMU object
FreeIMU my3IMU = FreeIMU();

// Yaw Pitch Roll
String zzzzzz = "";
String sYaw = "";
String sPitch = "";
String sRoll = "";
float ypr[3];
float Yaw = 0;
float Pitch = 0;
float Roll = 0;

// Software Version Information
String sver = "26-04";

void loop()
{

  // isFreeIMU
  isFreeIMU();

  // is RFM12B Radio
  isRFM12BRadio();

  // Inter Packet Delay
  delay(interPacketDelay);
  
}

getFreeIMU.ino

// FreeIMU
// isFreeIMU
void isFreeIMU(){

  // FreeIMU
  // Yaw Pitch Roll
  my3IMU.getYawPitchRoll(ypr);
  // Yaw
  Yaw = ypr[0];
  // Pitch
  Pitch = ypr[1];
  // Roll
  Roll = ypr[2];

}

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(){

  // sYaw, sPitch, sRoll ""
  sYaw = "";
  sPitch = "";
  sRoll = "";

  // sYaw, sPitch, sRoll concat
  sYaw.concat(Yaw);
  sPitch.concat(Pitch);
  sRoll.concat(Roll);

  // zzzzzz ""
  zzzzzz = "";

  // zzzzzz = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|*"
  zzzzzz = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|*";

  // sendSize Length
  sendSize = zzzzzz.length();

  // sendSize
  payload[sendSize];

  // sendSize, charAt
  for(byte i = 0; i < sendSize+1; i++){

    payload[i] = zzzzzz.charAt(i);
    
  }
    
  // payload
  Serial.print(payload);
  
  // Request ACK
  requestACK = sendSize;
  
  // Wakeup
  radio.Wakeup();
  
  // Turn the LED on HIGH
  digitalWrite( iLED , HIGH);
  
  // Send
  radio.Send(GATEWAYID, payload, sendSize, 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();

  // 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);

  // Set up I2C bus
  Wire.begin();

  // RFM12B Radio
  isSetupRFM12BRadio();

  // Pause
  delay(5);
  // Initialize IMU
  my3IMU.init();
  // Pause
  delay(5);

}

——

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

Project #26 – Radio Frequency – Moteino ASK – Mk03

——

#DonLucElectronics #DonLuc #RadioFrequency #Moteino #Send #Receive #ASK #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Moteino ASK

——

Moteino ASK

——

Moteino ASK

——

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

Project #26 – Radio Frequency – Moteino Receive – Mk02

——

#DonLucElectronics #DonLuc #RadioFrequency #Moteino #Receive #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Moteino Receive

——

Moteino Receive

——

Moteino Receive

——

Radio Receiver

In radio communications, a radio receiver, also known as a receiver, a wireless, or simply a radio, is an electronic device that receives radio waves and converts the information carried by them to a usable form. It is used with an antenna. The antenna intercepts radio waves and converts them to tiny alternating currents which are applied to the receiver, and the receiver extracts the desired information. The receiver uses electronic filters to separate the desired radio frequency signal from all the other signals picked up by the antenna, an electronic amplifier to increase the power of the signal for further processing, and finally recovers the desired information through demodulation.

Full Duplex

A simple illustration of a full-duplex communication system. Full-duplex is not common in handheld radios as shown here due to the cost and complexity of common duplexing methods, but is used in telephones, cellphones and cordless phones. A full-duplex (FDX) system allows communication in both directions, and, unlike half-duplex, allows this to happen simultaneously.

Land-line telephone networks are full-duplex since they allow both callers to speak and be heard at the same time. Full-duplex operation is achieved on a two-wire circuit through the use of a hybrid coil in a telephone hybrid. Modern cell phones are also full-duplex.

There is a technical distinction between full-duplex communication, which uses a single physical communication channel for both directions simultaneously, and dual-simplex communication which uses two distinct channels, one for each direction. From the user perspective, the technical difference doesn’t matter and both variants are commonly referred to as full duplex.

DL2211Mk05

1 x Moteino R2 (RFM12B)
1 x SparkFun FTDI Basic Breakout – 5V
1 x SparkFun Cerberus USB Cable

Moteino R2

TR0 – Digital 2
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
VIN – +3.3V
GND – GND

——

DL2211Mk05p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Moteino Receive - Mk02
26-02
DL2211Mk05p.ino
1 x Moteino R2 (RFM12B)
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-02";

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

Project #26 – Radio Frequency – Moteino Send – Mk01

——

#DonLucElectronics #DonLuc #RadioFrequency #Moteino #Send #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Moteino Send

——

Moteino Send

——

Moteino Send

——

Radio Frequency

Radio Frequency (RF) is the oscillation rate of an alternating electric current or voltage or of a magnetic, electric or electromagnetic field or mechanical system in the frequency range from around 20 kHz to around 300 GHz. This is roughly between the upper limit of audio frequencies and the lower limit of infrared frequencies, these are the frequencies at which energy from an oscillating current can radiate off a conductor into space as radio waves. Different sources specify different upper and lower bounds for the frequency range. Energy from RF currents in conductors can radiate into space as radio waves. This is the basis of radio technology.

Duplex Telecommunications

A duplex communication system is a point-to-point system composed of two or more connected parties or devices that can communicate with one another in both directions. Duplex systems are employed in many communications networks, either to allow for simultaneous communication in both directions between two connected parties or to provide a reverse path for the monitoring and remote adjustment of equipment in the field. There are two types of duplex communication systems: full-duplex (FDX) and half-duplex (HDX).

ISM Radio Band

The ISM radio bands are portions of the radio spectrum reserved internationally for industrial, scientific and medical (ISM) purposes, excluding applications in telecommunications. Examples of applications for the use of radio frequency (RF) energy in these bands include radio-frequency process heating, microwave ovens, and medical diathermy machines. The powerful emissions of these devices can create electromagnetic interference and disrupt radio communication using the same frequency, so these devices are limited to certain bands of frequencies. In general, communications equipment operating in ISM bands must tolerate any interference generated by ISM applications, and users have no regulatory protection from ISM device operation in these bands.

RFM12B Universal ISM Band FSK Transceiver

Hoperf is RFM12B is a single chip, low power, multi-channel FSK transceiver designed for use in applications requiring FCC or ETSI conformance for unlicensed use in the 433, 868 and 915 MHz bands. The RFM12B transceiver is a part of Hoperf EZRadio product line, which produces a flexible, low cost, and highly integrated solution that does not require production alignments. All required RF functions are integrated. Only an external crystal and bypass filtering are needed for operation.

Moteino

Moteino began as a low power wireless Arduino compatible development platform based on the popular ATmega328p chip used in the Arduino UNO. Moteinos are compatible and can communicate with any other Arduino or development platform that uses the popular HopeRF RFM69 or LoRa transceivers, or even the older RFM12B. Moteino also comes with an optional SPI flash memory chip for wireless programming, or data logging. Moteino was designed to be a compact, highly customizable and affordable development platform, suitable for IoT, home automation and long range wireless projects.

Moteino R2 (RFM12B)

  • Frequency Band: 433 MHz
  • Flash Memory: With 4Mbit Flash Chip

DL2211Mk04

1 x Moteino R2 (RFM12B)
1 x SparkFun FTDI Basic Breakout – 5V
1 x SparkFun Cerberus USB Cable

——

Moteino R2

TR0 – Digital 2
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
VIN – +3.3V
GND – GND

——

DL2211Mk04p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Moteino Send - Mk01
26-01
DL2211Mk04p.ino
1 x Moteino R2 (RFM12B)
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-01";

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();

}

——

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

Categories
Archives