1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

DATA transmission/receiving using SCR Radio modules.

Discussion in 'Oshonsoft' started by camerart, Oct 10, 2016.

  1. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    20,967
    Likes:
    630
    Location:
    Ex Yorks' Hants UK
  2. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.
    Hi N,

    Ok, let me know if this is correct!

    The simplest set-up? Connect GND plus 3.3V and USB serial (FTDI) TX and RX

    What does the SET connection do?

    Send some DATA though the serial connection and it should show on an SDRadio?

    C.
     
  3. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.

    Hi,

    Quick test and it looks as though module one is transmitting, thanks.

    C.
     

    Attached Files:

    • RX.jpg
      RX.jpg
      File size:
      175.8 KB
      Views:
      45
  6. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.
    Hi,

    The modules arrived yesterday. I've changed the power, changed the frequency, set two up on two laptops and they're talking to each other.

    I'm sure the range will cover my estate;) so should work as camera trigger or cat detectors etc Brilliantly easy. It opens ideas up.

    As you will know these modules have a chip on board that decodes the AT commands. I think that for a better range, the SX1276 modules will be better, but need a PIC or similar to convert the commands and control the radio module. This isn't easy, and if anyone comes across any code that is BASIC friendly or any help, let me know please, and I'll carry on with them.
    Thanks,
    C.
     
  7. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.
    Hi,
    The SX1276 chips have the LoRa system on them, which from what I can gather varies the TX/RX speed while checking for success, before speeding up to get the fastest DATA rate. (Please double check) Using this technology, on balloons 'line of sight' TX/RX distances of 400Kmtrs have been achieved. I think that there is a choice between LoRa and FSK, so perhaps they could be used simply.

    I have changed the attachments on Post #1 to this latest chip. The programs were written by Stuart Robinson. Here are a few links to his projects, which are mainly written in C. https://www.rcgroups.com/forums/showthread.php?t=2643322
    http://www.loratracker.uk/
    http://www.thebackshed.com/forum/forum_posts.asp?TID=7517

    If anyone could look at the programs on #1 and try to compile them in Oshonsoft and give me pointers to help me convert them please. I have made a start with the TX program:
    18F4520 32MHz-INT Micromite MK2 LoRa TX 111116 1500.txt

    C.
     
    Last edited: Nov 12, 2016
  8. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.
    Hi,
    I've added another program from Stuart Robinson called RELAY, he told me that it is the simplest of his programs, for us to start with. I have added the Header (I think it's called) for the 18F4520 down to the '################# lines. It uses the ATMEGA 328 chip, so pinouts need changing.

    I'm a bit puzzled by the lines such as:

    print "LORA.Setup"
    lora.resetdev 'Clear all registers to default
    lora.Write(lora_regopmode, &h08) 'RegOpMode, need to set to sleep mode before configure for LoRa mode
    lora.Write(lora_regocp, &h0b) 'RegOcp
    That have a full stop within them, if anyone could enlighten me on how they look in Oshonsoft please?.

    EDIT:I've made hopefully correct changes to the above program 'Called WITH CHANGES 18F4520..........'
    C.
     
    Last edited: Nov 13, 2016
  9. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.
    From SPI puzzle thread (ERIC GIBBS):
    hi,
    I guess you know NSS is /CS .?? [NOT CS]

    Where is the RESET connected.?

    Are the DIO pins allowed to 'float' the datasheet should tell you.

    As you say the PCB requires a 3.3v supply.

    I usually add a 10k pull up on MISO

    E


    EDIT:
    How are you planning to get the 18F2431 PIC to communicate via RS232 to the other PIC.????
    hi C,
    This is a clip from my circuit showing the SPI and 74HC125 level shifter.

    There are 100R's in series with the three PIC output pins to the HC125.
    The logic +5v High input current should be limited to < 20mA when powering the HC125 with3.3v.
    [I have sometimes used the HC without the 100R's with no problems, but I would not recommend this way]

    Note the 10k pull up for MISO.

    E

    Attached Files:
    [​IMG]
    A04.gif
    File size:
    11.9 KB
     
  10. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.
    PIC SX1276 18F2431.jpg
    Hi Eric,
    See attached circuit:

    I/ use Pickit3 in-circuit programming for Pc communication.
    2/ I've read that the SX1276 has clamped inputs and 22K resistors between SX1276 and PIC, appears to work ok, instead of level shifting. I've been using TTL without any resistor and noted that the voltage only reached 0.3V, so clamps appear to be working.

    Am I correct that the MCLR and SX1276 RESET should be pulled to GND by a button?

    EDIT: Corrected Button wiring.

    C.
     
    Last edited: Nov 27, 2016
  11. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.
    Hi,
    I have updated one of the programs on #1, , which compiles. (OOK) for the moment, as LoRa looks too complicated. What I'm trying to do is get the 18F2431 SPI to talk to the radio module. I'm a bit puzzled about the SSPCON and SSPSTAT settings.
    I simply want to either read one default register address (If there is anything in it) or write to one then read it.
    C.
     
    Last edited: Nov 27, 2016
  12. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    20,967
    Likes:
    630
    Location:
    Ex Yorks' Hants UK
    The PIC MCLR is active Low, the datasheet for the SX should tell you if the RESET is active High or Low.
    As it is labelled RESET I would assume that its active HIGH, check the d/s.
     
    • Agree Agree x 1
  13. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.
    Hi Eric,
    Both active LOW, with pull-up, single button works both SX and PIC
    C.
     
  14. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.
    Hi,
    I'm not getting the expected results from SPI reading Register values. I've tried many combinations to get default readings

    WRITE doesn't appear to be writing, and only the bottom part READ appears to be doing anything, so I've slowly reduced the suggested code down till the results changed.

    From the code below if the line [SPISend 0x06 'Produces 82] Is changed.

    Here is what is produced on the LCD
    0x00 shows 0
    0x01 4
    0x02 0
    0x03 26
    0x04 11
    0x05 0
    0x06 82
    0x07 228
    0x08 192
    0x09 0
    0xoa 65

    I can't find any correlation between the data sheet REGISTERS and these readings.

    Any clues?

    C.

    'SPI=====================================================
    spi:
    SPIPrepare
    'Dim addr As Byte
    'addr = 0x01
    Dim data As Byte
    'data = 0x00 'Changing this isn't doing anything

    'SPICSOn
    'SPISend 0x02 '0x02 is SPI WRITE COMMAND
    'SPISend addr
    'SPISend 0x08
    'SPICSOff
    SPICSOn
    'SPISend 0x03 'POSS READ??
    SPISend 0x06 'Produces 82 ++++++++++++++++++++++++++++++++
    SPIReceive data
    SPICSOff

    Lcdcmdout LcdClear
    Lcdout "Write To EEPROM"
    Lcdcmdout LcdLine2Home
    Lcdout "(", #1, ") = ", #data '# removed from front of 0x01
    WaitMs 500
     

    Attached Files:

  15. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    20,967
    Likes:
    630
    Location:
    Ex Yorks' Hants UK
    hi C,
    Are you saying you do not see any correlation with these read out values and the Table. image A01.??????
    I do.
    E
    Here is what is produced on the LCD
    0x00 shows 0
    0x01 4
    0x02 0
    0x03 26
    0x04 11
    0x05 0
    0x06 82
    0x07 228
    0x08 192
    0x09 0
    0xoa 65

    BTW:
    What is this line for.???
    'SPISend 0x02 '0x02 is SPI WRITE COMMAND
     

    Attached Files:

    • A01.gif
      A01.gif
      File size:
      136.4 KB
      Views:
      35
  16. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.
    Hi Eric,
    I do now:)

    I'm ok till the E4 0x6C 228 line. I have reference sheets, for conversion, but they don't include the middle line. How do you convert the 0x00 lines?

    This is from the SPI thread: I took it literally!
    2/ If I only wanted to read 'say' ADDRESS 0x02, I would expect the reply to be 0x1A. What would the minimum SPI code look like?
    The 0x02 is a SPI Write command (You did say the 0x06 line is not necessary, I now presume that none of similar lines are also)

    On your A01.gif, why don't the lines line up? Column 1 and your inlay with my LCD reading on.

    C.
     
  17. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    20,967
    Likes:
    630
    Location:
    Ex Yorks' Hants UK
    hi,
    The values in your Table are HEX values, the values Read by your Oshonsoft program are in Decimal.

    If you recall I asked are you including the OR 0x80 command when you Write a command to the Radio.??
    Looking at the LORA listing for Writing to the radio all the Commands are are Ored with 0x80, I believe the radio always expects the MSBit SET to indicate it's a WRITE command.

    Post the information for the Radio commands.

    E
     
  18. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.
    Hi Eric,
    I'm a bit unsure about HEX DECIMAL.

    I don't recall the OR 0x80 command question.

    First, I hope to set-up OOK (ON/OFF Keying MORSE), not LoRa as it should be easier.

    I don't have any information for Radio commands. I think it's just a matter of looking at the DATA sheet. I think that the first thing is to load any different registers for ones application. e,g For the first test: RegOpMode should be set %00101011 OOK--OOK--LOW--Transmission mode. Then I'll look at the output on an SDR screen (Visual radio)
    C.
     

    Attached Files:

  19. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    20,967
    Likes:
    630
    Location:
    Ex Yorks' Hants UK
  20. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,125
    Likes:
    10
    Location:
    Dorset UK.
    Hi Eric,
    Do you mean this one:

    Is this correct?
    For address 0x01 = %00000001
    WRITE would look like this %10000001
    READ would look like this %00000001
    C.
     

    Attached Files:

  21. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    20,967
    Likes:
    630
    Location:
    Ex Yorks' Hants UK
    hi,
    Basically yes.
    The Write routine, OR the Reg addr with 0x80
    example:

    ;say the regaddr you want to Write to is 0x07
    ;you could add the MSBit so it becomes 0x87
    ; or regaddr = regaddr OR 0x80

    'SPICSOn
    'SPISend
    'SPISend 0x87; write to addr
    'SPISend 0x08; this data
    'SPICSOff

    SPICSOn
    SPISend 0x07 ' Read from this addr
    SPIReceive data; the data content
    SPICSOff
     

Share This Page