diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f9a77a043abb1846f71d351797f025023bc78fe0 Binary files /dev/null and b/.DS_Store differ diff --git a/rf/.DS_Store b/rf/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a4bfe30f496628d9c8e3c4aa8725d75ddbfa8270 Binary files /dev/null and b/rf/.DS_Store differ diff --git a/rf/m0_rfm95_lora/.DS_Store b/rf/m0_rfm95_lora/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..dbe5b3fe8300bb3f401169cf88769b18d2faa154 Binary files /dev/null and b/rf/m0_rfm95_lora/.DS_Store differ diff --git a/rf/m0_rfm95_lora/feather_lora_scope.PNG b/rf/m0_rfm95_lora/feather_lora_scope.PNG new file mode 100755 index 0000000000000000000000000000000000000000..a55685de06128a807c1583ca0b9ddb18e357bffa Binary files /dev/null and b/rf/m0_rfm95_lora/feather_lora_scope.PNG differ diff --git a/rf/m0_rfm95_lora/feather_lora_setup.jpg b/rf/m0_rfm95_lora/feather_lora_setup.jpg new file mode 100644 index 0000000000000000000000000000000000000000..214b828a21fef6b478a7cfb1755127bf9e566e39 Binary files /dev/null and b/rf/m0_rfm95_lora/feather_lora_setup.jpg differ diff --git a/rf/m0_rfm95_lora/index.html b/rf/m0_rfm95_lora/index.html new file mode 100644 index 0000000000000000000000000000000000000000..964cf16c3de1cc5796311603d629e4204543135f --- /dev/null +++ b/rf/m0_rfm95_lora/index.html @@ -0,0 +1,151 @@ +<html> +<head> +<style> +pre code { + background-color: #eee; + border: 1px solid #999; + display: block; + padding: 20px; +} +figure{ + text-align: center +} +</style> + + +</head> +<body> + +<h1>Adafruit Feather M0 Radio with LoRa Radio Module 900MHz</h1> + +<!--<figure> +<img src='ring.png' width=50%> +<figcaption>RF Ring oscillator with NRF24L01. Note: the cursors are measuring half a cycle.</figcaption> +</figure>--> + +<p>This RF ring oscillator runs on the Adafruit Feather board incorporates a ATSAMD21G18 ARM Cortex M0 processor, clocked at 48 MHz with a <a href="http://www.hoperf.com/upload/rf/RFM95_96_97_98W.pdf">RFM95 Low Power Long Range Transceiver Module</a>.</p> + +<p>I used <a href="https://learn.adafruit.com/adafruit-feather-m0-radio-with-lora-radio-module/using-the-rfm-9x-radio">Adafruit's documentation</a> to get the oscillator running using the Arduino IDE.</p> + +<figure> +<img src='feather_lora_setup.jpg' width=40%> +<figcaption>Feather M0 LoRa setup</figcaption> +</figure> + +<p>Code is included below. The oscilloscope output was generated by pulling a GPIO pin high while the radio sent a message and waited to verify delivery of the message. The round trip time was 127ms which equates to a frequency of 7.9Hz. This is pretty long in comparison to other modules that we've been testing however the real benefit of the LoRa Radio Module is it's capability over long ranges.</p> + +<figure> +<img src='feather_lora_scope.png' width=60%> +<figcaption>Feather M0 LoRa ring oscillator results</figcaption> +</figure> + +<p>The code below is used on both modules with two lines changed to enable the ring to start. The variable counter should be adjusted as described in the comment and the starting sequence should be uncommented, again as described in the comment in the code.</p> + +<pre> +<code> +#include <SPI.h> +#include <RH_RF95.h> + +#define RFM95_CS 8 +#define RFM95_RST 4 +#define RFM95_INT 3 + + +// Change to 434.0 or other frequency, must match RX's freq! +#define RF95_FREQ 915.0 + +#define FIRE 12 + +// Singleton instance of the radio driver +RH_RF95 rf95(RFM95_CS, RFM95_INT); + +void setup() +{ + pinMode(RFM95_RST, OUTPUT); + digitalWrite(RFM95_RST, HIGH); + + while (!Serial); + Serial.begin(9600); + delay(100); + + Serial.println("Feather LoRa TX Test!"); + + // manual reset + digitalWrite(RFM95_RST, LOW); + delay(10); + digitalWrite(RFM95_RST, HIGH); + delay(10); + + while (!rf95.init()) { + Serial.println("LoRa radio init failed"); + while (1); + } + Serial.println("LoRa radio init OK!"); + + // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM + if (!rf95.setFrequency(RF95_FREQ)) { + Serial.println("setFrequency failed"); + while (1); + } + Serial.print("Set Freq to: "); Serial.println(RF95_FREQ); + + // Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on + + // The default transmitter power is 13dBm, using PA_BOOST. + // If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then + // you can set transmitter powers from 5 to 23 dBm: + rf95.setTxPower(23, false); +} + +int counter = 1; // 1 for the starter, 0 for the follower +int message; +bool start = true; + +void loop(){ + + // include for the starter, comment out for the follower + if(start == true){Serial.println("Starting");start = false;delay(2000);uint8_t data[] = "1";rf95.send(data, sizeof(data));rf95.waitPacketSent();} + + // listen for a message, and add it to counter + if (rf95.available()){ + + // process the message, not sure whether the length check is necessary + uint8_t buf[RH_RF95_MAX_MESSAGE_LEN]; + uint8_t len = sizeof(buf); + + if (rf95.recv(buf, &len)){ + message = atoi((char*)buf); + char buf[20]; + //Serial.print("Message = "); Serial.print(message); Serial.print(" Counter = "); Serial.println(counter); + + // if the message is greater than counter, then add one and send back + if(message > counter){ + + counter += 2; + itoa(counter, buf, 10); + + digitalWrite(FIRE,HIGH); + rf95.send((uint8_t*)buf,20); + rf95.waitPacketSent(); + //delay(1); + digitalWrite(FIRE,LOW); + + //Serial.print("Message = "); Serial.print(message); Serial.print(" Counter = "); Serial.println(counter); + } + } + } + + +} + +</code> +</pre> + + + + +<p><a href='../../index.html'>Back</a></p> + +</body> + +</html> \ No newline at end of file diff --git a/rf/nrf24L01/nrf-ftdi-ring.c b/rf/nrf24L01/nrf-ftdi-ring.c index 62b5f7230ec16be7d9dbffdc60b043a8d6c29460..7797df638c44a3c3f8430f6b51abe8373a4c8adb 100644 --- a/rf/nrf24L01/nrf-ftdi-ring.c +++ b/rf/nrf24L01/nrf-ftdi-ring.c @@ -187,7 +187,7 @@ void setup(){ //clear all interrupts tempval = read_register(STATUS); write_register(STATUS,tempval | MAX_RT | RX_DR | TX_DS); - _delay_ms(1); + _delay_ms(1);€2 sei(); //enter standby so we can write to configuration register. @@ -242,7 +242,7 @@ void read_token(){ //clear IRQ write_register(STATUS, tempval | RX_DR); - //check_registers(66); + check_registers(66); } int main(void) { @@ -251,7 +251,7 @@ int main(void) { if ( !(PORTC.IN & IRQ_BM)){ read_token(); //in standby token += 1; //increment token - //check_registers(65); + check_registers(65); send_token(); } //we use a signal on the usart to start the oscillation. @@ -261,9 +261,9 @@ int main(void) { PORTC.OUTCLR = CE_BM; _delay_us(ce_delay_us); send_token(); - //check_registers(64); + check_registers(64); } - //_delay_ms(10); + _delay_ms(10); } } diff --git a/rf/nrf24L01/nrf-ftdi-ring.c.hex b/rf/nrf24L01/nrf-ftdi-ring.c.hex new file mode 100644 index 0000000000000000000000000000000000000000..82edc36370ed481a0fc568d1d9d0dc78c74218c9 --- /dev/null +++ b/rf/nrf24L01/nrf-ftdi-ring.c.hex @@ -0,0 +1,125 @@ +:100000000C9456000C9473000C9473000C947300C1 +:100010000C9473000C9473000C9473000C94730094 +:100020000C9473000C9473000C9473000C94730084 +:100030000C9473000C9473000C9473000C94730074 +:100040000C9473000C9473000C9473000C94730064 +:100050000C9473000C9473000C9473000C94730054 +:100060000C9473000C9473000C9473000C94730044 +:100070000C9473000C9473000C9473000C94730034 +:100080000C9473000C9473000C9473000C94730024 +:100090000C9473000C9473000C9473000C94730014 +:1000A0000C9448030C946E030C94730011241FBE2F +:1000B000CFEFCDBFD3E2DEBF10E2A0E0B0E2E0E9D7 +:1000C000F7E002C005900D92AA32B107D9F721E2FC +:1000D000AAE2B0E201C01D92A433B207E1F70E9488 +:1000E00094030C94C6030C9400009C01FC01EA5F8D +:1000F000FE4F9081295F3E4FF90120819F5F9F77DE +:1001000081E0921301C080E008951F93CF93DF93A5 +:10011000EC01162F0E9475008823A1F0DE01AA5F72 +:10012000BE4F9C91FE01E90FF11DEC57FF4F10836C +:100130009F5F9F779C93E881F98192819C7F2A81C0 +:10014000922B9283DF91CF911F910895FC01EC5F78 +:10015000FE4F20818B5F9E4FFC01908181E029132F +:1001600001C080E00895FC01EB5FFE4F2081820F0B +:10017000911DDC0114968C9190819F5F9F779083F5 +:100180000895CF93DF93FC01DC01AC5FBE4F9C91DF +:100190009F5F9F77EF01CB5FDE4F2881C081D181C8 +:1001A0008881921749F02C91E20FF11D84839C9372 +:1001B00081E0DF91CF91089580E0FBCFCF93DF9373 +:1001C000DC01A95FBE4F3C91FC01EA5FFE4F20813C +:1001D000FC01C081D181321306C08A818C7F8A8361 +:1001E000DF91CF9108952C91820F911DFC01EC5766 +:1001F000FF4F808188838C918F5F8F778C93F0CFB6 +:10020000FC016083718342835383EB5FFE4F108256 +:1002100031971082339610828A5F9E4FFC011082C4 +:100220000895FC016283738308951F93CF93DF9336 +:10023000EC01162FCE010E9475008823D9F3612F9F +:10024000CE01DF91CF911F910C9485000F931F93E6 +:10025000CF93DF9300D000D0CDB7DEB78C014983B8 +:100260005A836B837C83642FC8010E9415016A81C5 +:10027000C8010E9415016B81C8010E9415016C81A3 +:10028000C8010E9415012496CDBFDEBFDF91CF913A +:100290001F910F9108950F931F93CF93DF9300D079 +:1002A00000D0CDB7DEB78C0149835A836B837C8342 +:1002B000642FC8010E9415016A81C8010E941501BE +:1002C0006B81C8010E9415016C81C8010E94150153 +:1002D0002496CDBFDEBFDF91CF911F910F9108957E +:1002E000FC0160817181828193810895FC016081AC +:1002F0007181828193810895FC01808191810895AB +:1003000090E1909346069AE09A95F1F700C08093A9 +:10031000E3088091E20887FFFCCF1092E308809108 +:10032000E20887FFFCCF8091E30890E190934506B7 +:100330009AE09A95F1F700C0089590E190934606EF +:100340009AE09A95F1F700C080628093E30880916B +:10035000E20887FFFCCF6093E3088091E20887FF03 +:10036000FCCF80E1809345068AE08A95F1F700C0D2 +:100370000895CF93DF9391E0909346069AE69A957D +:10038000F1F700C090E1909346069AE69A95F1F74E +:1003900000C01092E3089091E20897FFFCCFD09143 +:1003A000E3081092E3089091E20897FFFCCFC09118 +:1003B000E30890E1909345069AE69A95F1F700C01C +:1003C000682F8CE290E20E9415016D2F8CE290E282 +:1003D0000E9415016C2F8CE290E20E941501609141 +:1003E0002B208CE290E20E9415016AE08CE290E200 +:1003F000DF91CF910C94150163E180E00E949D0193 +:1004000081E0809345068FE094E00197F1F700C00A +:1004100000000895CF9382E08093500080915100B6 +:1004200081FFFCCF88ED84BF91E09093400088E08D +:100430008093610684E08093620620EC39E020938B +:100440002C2030932D2021E030E020932E2030937B +:100450002F201092312110923021109233211092CE +:10046000322183E08093C4098091C2098F7C80612E +:100470008093C2098BE78093C60980EC8093C709FB +:100480008091C30980618093C3098091C30988600A +:100490008093C3098091A20081608093A200C0E193 +:1004A000C093410688E38093540688E18093520606 +:1004B0009093410680ED8093E0081092E10880EA75 +:1004C00080934106C09345068FE39CE90197F1F7BD +:1004D00000C0000060E084E00E949D0160E081E0D7 +:1004E0000E949D0162E080E00E949D01EFEBFDE52E +:1004F0003197F1F700C0000061E082E00E949D01A9 +:1005000061E081E10E949D016EE086E00E949D0114 +:10051000C093460681EE8093E3088091E20887FF4E +:10052000FCCF80E180934506EFE3FFE13197F1F7DF +:1005300000C000008093460682EE8093E30880911D +:10054000E20887FFFCCF80E1809345068FE39FE1BF +:100550000197F1F700C0000080E00E9480018093C5 +:100560002A20682F606180E00E949D0187E00E9440 +:10057000800180932A20682F606787E00E949D0198 +:10058000EFE3FFE13197F1F700C00000789481E0DC +:1005900080934606FAE6FA95F1F700C0CF910C94E5 +:1005A000FC0180E1809346068AE08A95F1F700C05D +:1005B00080EA8093E3088091E20887FFFCCF809176 +:1005C000E30880932A201092E3088091E20887FFD5 +:1005D000FCCF80E1809345069AE09A95F1F700C040 +:1005E00060912A206E7F80E00E949D0181E08093CF +:1005F00045069AE69A95F1F700C0809346068FE08B +:1006000094E00197F1F700C000008091480682FD58 +:10061000FCCF87E00E94800180932A20682F6062CF +:1006200087E00E949D010C94FC0180E180934606C6 +:100630008AE08A95F1F700C081E68093E308809113 +:10064000E20887FFFCCF8091E30880932A20109274 +:10065000E3088091E20887FFFCCF8091E308809354 +:100660002B2080E1809345068AE08A95F1F700C04F +:1006700081E0809346068AE68A95F1F700C0609192 +:100680002A20606487E00E949D0182E40C94B901F5 +:100690001F920F920FB60F9211242F933F934F93F7 +:1006A0005F936F937F938F939F93AF93BF93EF93DA +:1006B000FF938CE290E20E94C100FF91EF91BF9105 +:1006C000AF919F918F917F916F915F914F913F91EA +:1006D0002F910F900FBE0F901F9018951F920F92A1 +:1006E0000FB60F9211242F933F934F935F936F9305 +:1006F0007F938F939F93AF93BF93EF93FF938CE27E +:1007000090E20E94DE00FF91EF91BF91AF919F9127 +:100710008F917F916F915F914F913F912F910F90AA +:100720000FBE0F901F9018950E940A02C1E08091A1 +:10073000480682FD0CC00E94150380912B208F5F1C +:1007400080932B2081E40E94B9010E94D1029091F4 +:10075000302180913121981779F08CE290E20E944B +:10076000B300C09346062AE62A95F1F700C00E941E +:10077000D10280E40E94B9018FEF99EF20E081500F +:1007800090402040E1F700C00000D1CFF894FFCFA7 +:100790000A008200402010E2E1A061200001021D59 +:1007A0001C17161514131211100F0E0D0C0B0A093D +:0A07B000080706050403020100001B +:00000001FF diff --git a/rf/nrf24L01/nrf-ftdi-ring.out b/rf/nrf24L01/nrf-ftdi-ring.out new file mode 100755 index 0000000000000000000000000000000000000000..7a91e172d5f16f1ce01ad6c26b5240eb96b261cb Binary files /dev/null and b/rf/nrf24L01/nrf-ftdi-ring.out differ