Posts

Showing posts with the label Arduino

SX1278: testing SDRAngel LoRa demodulator

Image
 18.2.2024 SX1278: testing SDRAngel LoRa demodulator Arduino Uno Dragino Lora Shield Semtech SX1278 SDRAngel 7.17.1 SDRAngel LoRa demodulator manages to properly decode TX with spreading factor 12. Spreading factor 11 produces wrong decoding of payload (FEC fix without ok correction)

Inspecting Verto water meter - 2

Image
 4.2.2024 Inspecting Verto water meter - 2 Some Verto water meter collector units use Lora communication at 433 MHz ISM band. Arduino Uno Dragino Lora shield (Semtech SX1278)     #include <SPI.h>   #define SERIAL_SPEED        115200   #define LORA_FREQ           433.300 #define STATE_SLEEP         0 #define STATE_STANDBY       1 #define STATE_FSRX          4 #define STATE_RX            5 #define S_DELAY             10 #define L_DELAY             100 #define RX_BUFFER_LEN       255 #define SX_FREQ          ...

Arduino UNO R4 RA4M1 register access

  18.8.2024 Arduino UNO R4 RA4M1 register access https://cdn.sparkfun.com/assets/b/1/d/3/6/RA4M1_Datasheet.pdf copy R7FA4M1AB.h from ...AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.2.0\ variants\MINIMA\includes\ra\fsp\src\bsp\cmsis\Device\RENESAS\Include to folder where your sketch is located. #include "R7FA4M1AB.h"   void setup() {   uint32_t startTime = millis();   while (!Serial && ((millis() - startTime) < 3000));   Serial.begin(9600);     // Reset status register 0   uint8_t v8 = R_SYSTEM->RSTSR0;   Serial.println(v8);   // Reset status register 1   uint16_t v16 = R_SYSTEM->RSTSR1;   Serial.println(v16);   // Voltage monitor 1 circuit control register 1   v8 = R_SYSTEM->LVD1CR1;   Serial.println(v8);   // System clock division control register   uint32_t v32 = R_SYSTEM->SCKDIVCR;   Serial.println(v32);   // Standby control register   v16 = R_...

Arduino & RX-4MM3F

Image
1.9.2024 Arduino & RX-4MM3F Arduino UNO R4 AUREL RX-4MM3F AM OOK receiver   const int dataPin = 8; const int agcPin  = 6; const int rssiPin = A1; int rssiValue = 0; PinStatus dataValue; char buf[8]; void setup() {   uint32_t startTime = millis();   while (!Serial && ((millis() - startTime) < 5000));   Serial.begin(9600);   analogReadResolution(12);   pinMode(dataPin, INPUT);   pinMode(rssiPin, INPUT);   pinMode(agcPin, OUTPUT);   digitalWrite(agcPin, LOW);   delay(250); } void loop() {   dataValue = digitalRead(dataPin);   rssiValue = analogRead(rssiPin);   sprintf(buf, "%4d %1d", rssiValue, dataValue);   Serial.println(buf); }

GNU Radio - Arduino Uno with OOK/ASK receiver

Image
  15.8.2023 GNU Radio - Arduino Uno with OOK/ASK receiver GNU Radio Companion 3.10.4.0 (Windows - Radioconda installer) Arduino Uno WL101-341 OOK/ASK receiver PySerial 3.5 + Python 3.11.4 I copied pyserial-3.5.dist-info and serial folders from Python 3.11.4 to C:\Users\<user>\radioconda\Lib\site-packages   Embedded Python block code   import numpy as np import serial from gnuradio import gr class blk(gr.sync_block):  # other base classes are basic_block, decim_block, interp_block     def __init__(self, comPort='COM5', comSpeed=38400.0, timeout=2):         gr.sync_block.__init__(             self,             name='window voltage',             in_sig=None,             out_sig=[np.byte]  ...

WL101-341 OOK/ASK decoder

Image
 2.1.2022 WL101-341 OOK/ASK decoder   Arduino used for providing 3.3V and GND.   Wireless OOK doorbell signal. WL101-341 data pins (2) output same signal. WL101-341 data output is random noise when there is no signal. Arduino Due code #define SERIAL_SPEED    57600 #define DATA_PIN        5 #define DATA_SIZE       3072 #define TIMEOUT         16000 #define PLOT_SCALE      16 int32_t data[DATA_SIZE]; uint32_t timeoutStart; volatile uint16_t idx = 0; volatile uint8_t state = 0; void setup() {   Serial.begin(SERIAL_SPEED);   pinMode(DATA_PIN, INPUT);   memset(data, 0, sizeof(data));   timeoutStart = millis();   attachInterrupt(digitalPinToInterrupt(DATA_PIN), isr, CHANGE); } void loop() {   if (state == 1) {     detachInterrupt(digitalPinToInterrupt(DATA_PIN));     state = 2...

Tools for inspecting OOK 2

Image
19.5.2021 Tools for inspecting OOK 2 Arduino Due, CC1120 (ccRF 3 click board)   CC1120 ASK/OOK transparent serial mode. CC1120 GPIO3 configured for CARRIER SENSE, triggers when RSSI is above defined threshold (AGC_CS_THR register). GPIO0 configured for SERIAL_RX. #include <SPI.h> #include "cc1120.h" #define PRINT_INFO #undef PRINT_INFO #define DATA_SIZE   512 #define PLOT_SCALE  64 uint16_t data[DATA_SIZE]; // uint16_t is enough for max 32767 uS pulse len // bit 15 = 1 when high pulse, 0 when low pulse volatile bool printData = false; volatile uint16_t idx   = 0; void setup() {   Serial.begin(57600);   pinMode(RESET_PIN, OUTPUT);   pinMode(SS_PIN, OUTPUT);   pinMode(GDO0_PIN, INPUT); // SERIAL_RX   pinMode(GDO3_PIN, INPUT); // CARRIER SENSE   digitalWrite(SS_PIN, HIGH);   digitalWrite(RESET_PIN, HIGH);   memset(data, 0, sizeof(data));     SPI.begin();   strobeSPI(SNOP);   // Sync off   u...

Super simple LoraWAN rx for Arduino/SX127x

Image
 12.4.2021 Super simple LoraWAN rx for Arduino/SX127x #include <SPI.h> #define SERIAL_SPEED        9600 #define LORA_FREQ           869.525 #define STATE_SLEEP         0 #define STATE_STANDBY       1 #define STATE_FSRX          4 #define STATE_RX            5 #define S_DELAY             10 #define L_DELAY             100 #define RX_BUFFER_LEN       255 #define SX_FREQ             "Frequency " #define SX_VERSION          "Chip version " #define PRINT_MODEM_STAT #undef PRINT_MO...

Experimenting with CC1120 IOCFG pad analog mode - 2

Image
1.8.2021 Experimenting with CC1120 IOCFG pad analog mode - 2 Hardware: CC1120 + Arduino Due Synchronous serial mode TX (analogWrite), CC1120 IOCFG0 (HIGHZ + pad in analog mode)     #include <SPI.h> #include "cc1120.h" #define PRINT_INFO  1 #define NUM_SAMPLES 120 int16_t waveForm[NUM_SAMPLES] = {     0x44, 0x88, 0xcc, 0x110, 0x154, 0x198, 0x1dc, 0x220, 0x264, 0x2a8,     0x2ec, 0x330, 0x374, 0x3b8, 0x3fc, 0x440, 0x484, 0x4c8, 0x50c, 0x550,     0x594, 0x5d8, 0x61c, 0x660, 0x6a4, 0x6e8, 0x72c, 0x770, 0x7b4, 0x7f8,     0x83c, 0x880, 0x8c4, 0x908, 0x94c, 0x990, 0x9d4, 0xa18, 0xa5c, 0xaa0,     0xae4, 0xb28, 0xb6c, 0xbb0, 0xbf4, 0xc38, 0xc7c, 0xcc0, 0xd04, 0xd48,     0xd8c, 0xdd0, 0xe14, 0xe58, 0xe9c, 0xee0, 0xf24, 0xf68, 0xfac, 0xff0,     0xfac, 0xf68, 0xf24, 0xee0, 0xe9c, 0xe58, 0xe14, 0xdd0, 0xd8c, 0xd48,     0xd04, 0xcc0, 0xc7c, 0xc38, 0xbf4, 0xbb0, 0...

Experimenting with CC1120 IOCFG pad analog mode

Image
 24.7.2021 Experimenting with CC1120 IOCFG pad analog mode Hardware: CC1120 + Arduino Due Due DAC1 in free running mode and connected to CC1120 IOCFG0 (HIGHZ + pad in analog mode). Transparent serial mode TX.   #include <SPI.h> #include "cc1120.h" #define PRINT_INFO  1 #define PERIOD      1500 void setup() {   Serial.begin(9600);   pinMode(RESET_PIN, OUTPUT);   pinMode(SS_PIN, OUTPUT);   digitalWrite(SS_PIN, HIGH);   digitalWrite(RESET_PIN, HIGH);   analogWriteResolution(12);   PMC->PMC_PCER1 = PMC_PCER1_PID38;   DACC->DACC_CR = DACC_CR_SWRST;   DACC->DACC_MR = DACC_MR_TRGEN_DIS                                       | DACC_MR_USER_SEL_CHANNEL1            ...