Simplest code for programming RFM69 (SX1276)

Camerart

Member
Hi,

I am trying to program RFM69 (SX1276) modules in BASIC. (I'm actually trying to program PICs to control these modules)

I have attached photos of top and bottom. They show RFM69 chips, but when I enquired about programming instructions etc, they told me that the chips are actually sx1276.

I hope to use these chips/modules for monitoring wildlife and triggering cameras, perhaps balloon tracking also following my radio control models, by receiving GPS.

I want firstly to have the simplest transmission set-up, which I could monitor with an SDRadio. Then learn how to send and receive, and 'handshake?'

I am however slightly handicapped by only being able to 'speak' BASIC (OSHONSOFT), this is why I've joined your forum, as there is quite a bit of code written in C, but I have difficulty reading it.

I have read threads on this site written by SRNET and STUART ROBINSON that look interesting, and for other chips, and I think I could translate one of the programs, if I was pointed at the best minimum one, or help in writing a new one, if anyone would like to help me, please.

EDIT: See correction above

Cheers, Camerart.
 

Attachments

Last edited:

manuka

Senior Member
The RFM69 is a regular FSK/ASK etc 433 MHz Chinese HopeRF transceiver module - details here. You may be confusing it with a Semtech LoRa capable RFM96 ? See pix below.

As Stuart Robinson (a.k.a. SRNET) amply verifies,LoRa devices are far & away superior for the likes of location & balloon tracking -reliable ranges are typically an order of magnitude superior under the same setup ! Yes -several km in built up areas instead of 100s of metres etc !

For LoRa insights perhaps see my popular LoRa Instructable. I doubt if SDR (Software Defined Radio) will be possible,as a closely matching LoRa device is usually needed. Stuart has done work with a Bluetooth feed however.

But where are you based ? What skills, resources, time & budget do you have ? If your coding skills are "BASIC" then you may want to consider serial friendly "2 chipper" LoRa devices, as single chippers are usually SPI (Serial Peripheral Interface) addressed. Although well established, SPI makes for more involved coding due to the multiple micro-RF device data & control links required.

Extra: By chance I've been considering Chengdu EByte's "2 chipper" LoRa offerings (barebones pix attached) for a get ya feet wet Lora project Check features of this module here. Stan.
 

Attachments

Last edited:

Camerart

Member
The RFM69 is a regular FSK/ASK etc 433 MHz Chinese HopeRF transceiver module - details here. You may be confusing it with a Semtech LoRa capable RFM96 Stan.
Hi S,

Perhaps we could clarify which CHIP/MODULE we are working with. I realise that it isn't easy for me to program PICs to control these modules, but if I make the effort, I want to try the best choice, so I don't need to change later.

I notice this message at the bottom of one of the data sheets:
Note: HOPERF, a long established Chinese wireless data firm, offer LoRa™ modules with a "'7 a side" RF96/97/98 IC that seems akin to Semtech's SX127x. It's unknown however if these are just an Asian LoRa™ 2nd sourcing...

When I asked for documentation for the modules I bought (Which appear to be RFM69CW from your JPG) I was told they are actually SX1276. It looks to me that RFM69=SX1276 and RFM96=SX1278.

I'm guessing when I think RFM96/SX1278 chip would be the best choice.

Now we come to the module with the CHIP on board, I've seen quite a few choices. DORJI look to be making modules with what appear to have a not too difficult set-up. The modules I have cost a few pound/dollars. There are some that cost 10s of pounds. I want to keep it low cost if possible.

All a bit confusing really.

C.
 

srnet

Senior Member
I hope to use these chips/modules for monitoring wildlife and triggering cameras, perhaps balloon tracking also following my radio control models, by receiving GPS.

I want firstly to have the simplest transmission set-up, which I could monitor with an SDRadio. Then learn how to send and receive, and 'handshake?'
The picture is of a Hope RF module that uses one of the Semtech SX127X chips. Dorji do similar modules. The SX127x is programmed at the registry level via the SPI interface.

As long as you understand how LoRa works then programming the devices is not hard, compared to some other modules.

There have been experiments with using SDRs to pick up LoRa, but as yet with very limited success.

One of the first very long distance uses of LoRa was my long distance balloon tracker in January 2015, 240km two way comms @ 10mW. This was using a PICAXE.

There is a lot of background stuff on LoRa here;

http://www.loratracker.uk/

If you goto the links page there is LoRa code for PICAXE, Micromite and Arduino.
 

Camerart

Member
Hi S,

I presume when you say "The picture is a hope RF module" you mean the image on #2 not the one I posted in #1

Image from #2, There are two chips on the board, is one a PIC? If so does it load the default registers into the radio chip, or does the radio chip hold default register settings which load at switch on?

I think I understand how to use an SPI interface and load registers.

I looked at your programs, but they are far byond my skills, I will have to start more simply, then learn as I go.

Thanks, C.
 

manuka

Senior Member
Camerat - sigh- you have yet to advise where you are, your time frame, budget, e-skill level ( especially wireless) & resources... Appreciate too that countries - especially the USA- differ in their UHF regulations.

I've not knowingly used HopeRF's "69",although it's 7 a side pinouts are a Semtech SX12xx characteristic. I was of the opinion (supported by a quick Google) that it - & variants- is NOT LoRa friendly however. Google in fact reveals that the RFM69x uses a HopeRF 2nd sourced SemTech SX1231, which another forum also recently informed you of !

Irrespective of this, the "69" modules single RF IC (& reverse side pin ID) implies that it's SPI addressed. Given your admirably self confessed limited experiences I'd strongly suggest avoiding these & starting with 2 chip TTL adressed devices - even though they cost more & are a tad heavier than SPI ones.

Many such "2 chip" UHF data modules (either normal FSK or LoRa) use a cheap China sourced micro to handle TXD & RXD serial data. My initial LoRa Instructable used Dorji's TTL friendly LoRa module, but cheaper & smaller offerings (EByte etc) increasingly abound.

A play around with classic ASK devices may greatly assist as well. Dorji's offerings (below) have long been considered ideal for such insights.

FWIW a recently released & dirt cheap HC12 UHF data transceiver module has become very popular, & it can be readily configured just with a GUI too - see HC12 Forum discussion. Stan. in sunny NZ
 

Attachments

Last edited:

Camerart

Member
Camerat - sigh- you have yet to advise where you are, your time frame, budget, e-skill level ( especially wireless) & resources... Appreciate too that countries - especially the USA- differ in their UHF regulations.

I've not knowingly used HopeRF's "69",although it's 7 a side pinouts are a Semtech SX12xx characteristic. I was of the opinion (supported by a quick Google) that it - & variants- is NOT LoRa friendly however. Google in fact reveals that the RFM69x uses a HopeRF 2nd sourced SemTech SX1231, which another forum also recently informed you of !

Irrespective of this, the "69" modules single RF IC (& reverse side pin ID) implies that it's SPI addressed. Given your admirably self confessed limited experiences I'd strongly suggest avoiding these & starting with 2 chip TTL adressed devices - even though they cost more & are a tad heavier than SPI ones.

Many such "2 chip" UHF data modules (either normal FSK or LoRa) use a cheap China sourced micro to handle TXD & RXD serial data. My initial LoRa Instructable used Dorji's TTL friendly LoRa module, but cheaper & smaller offerings (EByte etc) increasingly abound.

A play around with classic ASK devices may greatly assist as well. Dorji's offerings (below) have long been considered ideal for such insights.

FWIW a recently released & dirt cheap HC12 UHF data transceiver module has become very popular, & it can be readily configured just with a GUI too - see HC12 Forum discussion. Stan. in sunny NZ
Hi S,

I live in the UK. Lots of pensioner time (with a pensioner brain:)) endless budget:D:cool:, Skill level? slowly relentless.

I have the HC12 modules working ok. Also Dorji DRA818 working ok.

Regarding the 'other forum' information, I welcome second opinions, as they are sometimes different.

I am particularly equiring about the LoRa chips. I want to learn the 'best' one. I am guessing that the register defaults are loaded on switch on, and ask, are the default registers loaded by a second chip (PIC) or are they already in the radio chip? If the default registers are already in the radio chip, I can change them ok with SPI. From how I have read the data sheet so far, I can leave the radio in FSK and not LoRa then move to LoRa later, is this correct?

The problem with 'second chip' modules, is that with my simulator, I have to choose a particular PIC, which is 18F4520.

C.
 
Last edited:

srnet

Senior Member
Hi S,

I presume when you say "The picture is a hope RF module" you mean the image on #2 not the one I posted in #1
No, I quoted your message #1, so referred to the picture in that post.

You did mention balloon tracking and RC models, and when you connect all the bits of program needed to read GPSs and parse the data into a form to be transmitted, then the programs do tend to be non-simple.

There are modules that use another micro to act as a front end, but I have yet to see one that allows for the fine control that is needed to maximize performance for applications such as HAB and RC model tracking where maximum range is essential.
 

Camerart

Member
No, I quoted your message #1, so referred to the picture in that post.

You did mention balloon tracking and RC models, and when you connect all the bits of program needed to read GPSs and parse the data into a form to be transmitted, then the programs do tend to be non-simple.

There are modules that use another micro to act as a front end, but I have yet to see one that allows for the fine control that is needed to maximize performance for applications such as HAB and RC model tracking where maximum range is essential.
Hi S,

Ok, good. So let's assume that the sellers that told me it is an SX1276 chip, are correct.

Looking at RegFifo--LongRangeMode--0x00 or 0x01 FSK/LoRa. It appears tome that the default is for FSK. Repeated from the last post if I simply switch on the SX1276, are the default registers true?

Thanks, C.
 

manuka

Senior Member
Camerate: OK & thanks for insights. As you & SRNET are in the same country (& time zone) best I leave you to it. Stuart is a great fan of HopeRF's RFM96 433 MHz LoRa modules in fact. Parting thoughts -

* The 18F4520 seems rather an overkill for your application? Why not use one of the PICAXE family?!

* LoRa technology is quite new (2014 -) so it's fair to say there's yet no "best" module. MicroChip's RN2483 looks promising though.

* Irrespective of Semtech/HopeRF origin, "non LoRa" (?) SX1231 differ significantly from LoRa capable SX1276.

Stan. in NZ
 

Camerart

Member
Camerate: OK & thanks for insights. As you & SRNET are in the same country (& time zone) best I leave you to it. However -

* The 18F4520 seems rather an overkill for your application? Why not use one of the PICAXE family?!

* LoRa technology is quite new (2014 -) so it's fair to say there's yet no "best" module. MicroChip's RN2483 looked promising though.

* Irrespective of Semtech/HopeRF origin, "non LoRa" (?) SX1231 differ significantly from LoRa capable SX1276.

Stan. in NZ
Hi M,

Don't worry about the time zone, the world is a small place nowadays, keep contributing. (Summer's coming)

It's a sharp learning curve, and I chose the 18F4520 as the 'best' one I use, but your comment of overkill is intriguing. Will you let me know what qualities the PIC needs, so that I can choose a lesser one please?

C.
 

srnet

Senior Member
Hi S,

Ok, good. So let's assume that the sellers that told me it is an SX1276 chip, are correct.

Looking at RegFifo--LongRangeMode--0x00 or 0x01 FSK/LoRa. It appears tome that the default is for FSK. Repeated from the last post if I simply switch on the SX1276, are the default registers true?

Thanks, C.
Its not that important which 'mode' the LoRa device starts in, there is a dual set of registers, one for LoRa the other for FSK.

Your welcome to try FSK if you want, but it does look a lot more complex than the LoRa setup and does not have the performance.

Beyond the defaults you need to work out which LoRa settings are needed appropriate to the application, you can go from high data rate (short distance) and low data rate (long distance).

The choice of mode also needs to be appropriate for the bandwidth and duty cycle that is allowed for the frequency band in use.
 

Camerart

Member
Its not that important which 'mode' the LoRa device starts in, there is a dual set of registers, one for LoRa the other for FSK.

Your welcome to try FSK if you want, but it does look a lot more complex than the LoRa setup and does not have the performance.

Beyond the defaults you need to work out which LoRa settings are needed appropriate to the application, you can go from high data rate (short distance) and low data rate (long distance).

The choice of mode also needs to be appropriate for the bandwidth and duty cycle that is allowed for the frequency band in use.
Hi S,

All understood, thanks. There are many setting to play with.

Is the SX1276 already programmed with the default registers, so even if the settings are all wrong, at switch on if I TX should it transmit?

C.
 

srnet

Senior Member
Hi S,

All understood, thanks. There are many setting to play with.

Is the SX1276 already programmed with the default registers, so even if the settings are all wrong, at switch on if I TX should it transmit?

C.
No idea whether it will transmit on its defaults, I have always programmed the module to the settings I want first.

The other issue would be are the defaults legal to use.

And you still need to load the data the LoRa device is going to send.
 
Last edited:

manuka

Senior Member

Attachments

srnet

Senior Member
for a cute mid 2016 Lora receiver/relay
The LoRa relay is about as simple as it gets, RX and TX in one simple minimalist bit of hardware and software. In terms of extending the reach of LoRa even further, its extremely effective.

As for data sheets, the SX127x one is better than most, and if you cannot make any sense of it you will struggle to use the LoRa devices at register level.
 

manuka

Senior Member
Stuart: Welll said. Have you considered production/ 2nd sourcing the LoRa relay cutie ? I'd be a starter! Stan.
 

srnet

Senior Member
Stuart: Welll said. Have you considered production/ 2nd sourcing the LoRa relay cutie ? I'd be a starter! Stan.
Not possible for me to sell them in the EU, due to the silly cost of getting a RF device compliance tested.

However, nothing preventing me selling them outside of the EU ..................

It is cute though, and there are likely some power savings to be had in RX mode by using the CAD functionality to reduce the normal RX current.
 

manuka

Senior Member
-nothing preventing me selling them outside of the EU-
OK - I'd be most interested to following up on this! Paypal ? NZ tends an offshore province of China these days, & with the associated free trade agreements between NZ, China & Australia we're well placed to source parts. Best we 1:1 PM or email? Stan.
 

Camerart

Member
Camerat: I strongly suggest that you check Stuart's (a.k.a. SRNET) outstanding LoRa constructions.

Probably his most up to date resource is here,but also scroll down this LoRa Tracker site for a cute mid 2016 Lora receiver/relay. There's also 2015 era circuitry for a Micromite MkII & RFM98 LoRa receiver..

Although deceptively small his favoured RFM9x modules are far from simple - check the 121 pages of data! Stan.
Hi,

Thanks for the links Stan, just looking through all of the stuff.

Srnet: Lots of excellent work, well done. I chose the Micromite MK2 as it is written in BASIC. I need to translate it to get it to compile in Oshonsoft, then I can 'see' it working in the Simulator.

Before coming to this forum, I have a post on an Oshonsoft forum where I post my programs and swap notes, is it ok to post my adaption of your program there please?

Will the LoRa technology be able to receive an NMEA sentence and transmit some DATA (Not yet worked on, but I suspect not too long) within 1 second?

Cheers, C.
 

srnet

Senior Member
Before coming to this forum, I have a post on an Oshonsoft forum where I post my programs and swap notes, is it ok to post my adaption of your program there please?

Will the LoRa technology be able to receive an NMEA sentence and transmit some DATA (Not yet worked on, but I suspect not too long) within 1 second?
No problems with you posting the code, its available for anyone to download anyway.

Cannot answer your other question about NMEA, you would need to provide the details of what it is you are trying to do.
 

Camerart

Member
No problems with you posting the code, its available for anyone to download anyway.
Ok, good, thanks.

Cannot answer your other question about NMEA, you would need to provide the details of what it is you are trying to do.
I have ideas for using them for many uses,such as camera sensing/triggering being the simplest, to receive an NMEA sentence of possibly 60 characters once/sec, then hopefully send DATA in the rest of the sec. Perhaps you could let me know if this sounds feasible? I am only asking for a guess, as I'll look into it later.

C.
 

srnet

Senior Member
I have ideas for using them for many uses,such as camera sensing/triggering being the simplest, to receive an NMEA sentence of possibly 60 characters once/sec, then hopefully send DATA in the rest of the sec. Perhaps you could let me know if this sounds feasible? I am only asking for a guess, as I'll look into it later.
Regular transmissions of large packets requires a fast on air data rate, faster data rates means larger bandwidths and shorter distances. At most of the useable LoRa bandwidths (41khz and above) you will likely face a legal restiction of a 10% duty rate, so for instance you could only TX for 100mS every 1 sec.

The range you get depends mainly on the environment and antenna setup, read my commnets about a 1000:1 rule here;

http://www.loratracker.uk/?p=381

So when you ask a question as to whether sending a full NMEA sentence every second sounds feasible, the answer is simply;

Maybe, and it would depend on the details of what you are actually trying to do ...................
 

Camerart

Member
Regular transmissions of large packets requires a fast on air data rate, faster data rates means larger bandwidths and shorter distances. At most of the useable LoRa bandwidths (41khz and above) you will likely face a legal restiction of a 10% duty rate, so for instance you could only TX for 100mS every 1 sec.

The range you get depends mainly on the environment and antenna setup, read my commnets about a 1000:1 rule here;

http://www.loratracker.uk/?p=381

So when you ask a question as to whether sending a full NMEA sentence every second sounds feasible, the answer is simply;

Maybe, and it would depend on the details of what you are actually trying to do ...................
Hi S,
Understood, thanks. I'll get on with getting a pair to work first, this may take some time.

Well done with your projects, they are inspirational. And to think some people do crosswords and sudoko to exercise their brains instead!

C.
 

Camerart

Member
Hi,
I'm going through the registers and would like to ask 2 questions:

1/When the radio chip is powered on, with no other chip, are the default registers already loaded?
2/From a couple of programs, I note that there are lines:
Const lora_regfrmsb = 0x06 '&h06
Const lora_regfrmid = 0x07 '&h07
Const lora_regfrlsb = 0x08 '&h08
Should they read:
Const lora_regfrfmsb = 0x06?
Const lora_regfrfmid = 0x07?
Const lora_regfrflsb = 0x08?

C.
 

srnet

Senior Member
1 There are register values that are loades at reset, and some default are loaded when you configure for LoRa mode, the datasheet gives the details.

2. No, the program listing for program constants is corrrect, it has to be by definition really.
 

Camerart

Member
1 There are register values that are loades at reset, and some default are loaded when you configure for LoRa mode, the datasheet gives the details.

2. No, the program listing for program constants is corrrect, it has to be by definition really.
Hi S,
Ok, thanks.
1/ Good, I was hoping the defaults are inbuilt, with any changes for laws, preference etc loaded afterwards.
2/Ok, I'm trying to be careful while looking at the DATA sheet and spotted the little f in there, but that's fine.

Actually the Data sheet is kind of biased to LoRa I think, but I'm coming to the conclusion that LoRa is a bit too difficult for me, so I have to go for the simpler 'radio wise' but more difficult 'Data sheet wise' option of FSK. Hopefully I can update at a later date:)

Cheers, C.
 

hippy

Technical Support
Staff member
2/Ok, I'm trying to be careful while looking at the DATA sheet and spotted the little f in there, but that's fine.
It might have helped to explicitly point out that discrepancy; I thought you were querying '&h comments, did not initial spot the "f" difference in the constant names.

The constants have to be named to match how they are used elsewhere in the program. Ideally naming should match datasheet terms but it doesn't matter within a program if they don't.

It's like Brits calling a toilet a "loo" while Americans call it a "john". As long as the name represents what it is meant to represent it doesn't actually matter what names is used.
 

Camerart

Member
It might have helped to explicitly point out that discrepancy; I thought you were querying '&h comments, did not initial spot the "f" difference in the constant names.

The constants have to be named to match how they are used elsewhere in the program. Ideally naming should match datasheet terms but it doesn't matter within a program if they don't.

It's like Brits calling a toilet a "loo" while Americans call it a "john". As long as the name represents what it is meant to represent it doesn't actually matter what names is used.
Hi H,
I marked the missing f in red, I'll use a different method if there's a next time. I kind of guessed that logically, the choice wouldn't have changed it apart of by error. When I was setting variables today, I copied and paste them from the Data sheet. I still made errors.

Regarding American English: I'm always puzzled why they call the toilet the bathroom. My bathroom is next door to the toilet, so I hope they don't use it for relief if they ever visit:)
C.
 
Last edited:

Montloker

New Member
Hi Camerart,

I would like to know if you have made any progress with the code to program the RFM69.
A few weeks ago I opened a thread here. But no one helps me.

Thanks You
 

Camerart

Member

Montloker

New Member
Hi,

I also program in basic.

When the RFM69 modules come in I will start with the code, and have what we do.

If the Micro goes to 5V and the RFM96 go to 3.3V I would put a TXS0108EPWR, I2C supports.

THX.
 

Camerart

Member
Hi,

I also program in basic.

When the RFM69 modules come in I will start with the code, and have what we do.

If the Micro goes to 5V and the RFM96 go to 3.3V I would put a TXS0108EPWR, I2C supports.

THX.
Hi m,

First: Will you reply to my question in post#31 please.

C.
 
Top