Arduino with xbee shield + mDot


(Manuel Betancurt) #1

I want to use an arduino to connect to the conduit LoRa gateway, I have the xbee shield with the mDot,

before I can do anything, I want to make sure the mDot is communicating with arduino, but I dont have enough info to do this,

so, should the mdot just get and put messages using the “serial monitor” on the arduino?

I just have an empty hello script to test this…

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
 
}

then open the serial monitor and enter “+++” on the textField and then “send”…

will this be enough to test the modem?

are there any instructions on how to proceed with an arduino and xbee shield?

Thanks!


(Andrew Maggio) #2

Hey Manuel, I sent you an email about getting it running.

But in summary, here are the commands you’ll need to issue to get onto TTN (without my //comments)

at+pn=1 // Set Public Network to true
at+njm=0 // Set Network Join Mode to manual
at+fsb=7 // Set Frequency Sub Band to whatever your Conduit is set to. Mine is 7
at+ack=0 // Turn off acknowledgements (not supported by TTN yet)
at+na=12345678 // Pick a number. This is the node address and should be unique for each node.
at+nk=0,2B7E151628AED2A6ABF7158809CF4F3C // Set Network Key for TTN
at+nsk=2B7E151628AED2A6ABF7158809CF4F3C // Set Network Session Key for TTN
at+dsk=2B7E151628AED2A6ABF7158809CF4F3C // Set Data Session Key for TTN.

Then issue:

at+join
at+send=HelloWorld


(Manuel Betancurt) #3

Hi Andrew!, thanks for the response, I will try to join the TTN, after my "hello world" happens,

I got another question please, will the mDot modem respond with any info when connected on serial monitor? like with an empty sketch can I just issue AT commands from serial monitor?

I also tried with just sending "AT" on the arduino "setup", should I be able to see the response on the serial monitor?

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

  Serial.print("AT");

}

void loop() {
  // put your main code here, to run repeatedly:

}

So far Im not getting any response, how to print the responses?, Im missing the basic setup :confused:

Thanks!


(Andrew Maggio) #4

If you're using an Arduino Uno, then there is only one UART, which is shared between the USB port and the mDot. Easiest way to test functionality is to use a blank sketch (no Serial.begin) and just open the serial monitor (at 115200). If you type "AT", you should get an "OK" back from the mDot.

Your sketch above should work - almost! Change the Serial.print to Serial.println. Also, the sketch will probably run before your serial monitor gets connected, so maybe put a delay at the start.

If you have an Arduino Leonardo, then it has separate UART for the USB port and the mDot. In which case you'll need a sketch to pass characters back and forth between the two ports. Like this:

void setup()
{
Serial.begin(115200);
Serial1.begin(115200);
}

void loop()
{
if (Serial.available()) Serial1.write(Serial.read());
if (Serial1.available()) Serial.write(Serial1.read());
}


(Manuel Betancurt) #5

hey Andrew, thanks for the help,
serial monitor not happy yet to test,
yes im using arduino uno, I did

Easiest way to test functionality is to use a blank sketch (no Serial.begin) and just open the serial monitor (at 115200). If you type "AT", you should get an "OK" back from the mDot

but no response yet from the serial monitor.
Thanks getting there :wink: I ordered the mDot programmer [devKit], so is easier to user, also 10 mdots to start having fun...

Will continue checking this arduino interface, Thanks!


#6

hey @manuel

what are the model numbers of the devices you got? I'm looking to make a simple node to get started, and I think the mDots are the way to go here in Sydney, for now!

Also where did you get the hardware from? i hear you might be setting up a Things Network gateway in the coming months too?! phenomenal work!


(Manuel Betancurt) #7

hi @wills I got the mDot, multitech gateway and the programmer, from @maj email msg

"
The gateways we use are Multitech Conduits: http://www.multitech.com/models/94557202LFYou’ll also need an mCard: http://www.multitech.com/models/94557300LFThe nodes are Multitech mDots: http://www.multitech.com/brands/multiconnect-mdotYou’ll also need a LoRa (915Mhz) antenna for the mDot. I think the mCard for the gateway comes with one, but it’s just a small dipole. Good for indoors/testing.
You can buy them from http://www.semiconductorstore.com."

Im waiting now for more mDots and the programmer, let me know how you go.

Yes im setting up a network on Surry Hills, and inner west soon.
:]

M.


#8

Thanks @manuel - can't wait until your gateway is up and running! Thanks heaps for providing it.

I'll grab an mDot to get started, but I'm not sure which is which. Which one did you get?

  • MTDOT-915-M1-TRC-1 mDot 915 MHz SMT LoRa RF Pad (Single Pack)
  • MTDOT-915-M1-UFL-1 mDot 915 MHz SMT LoRa UFL (Single Pack)
  • MTDOT-915-X1-SMA-1 mDot 915 MHz XBee LoRa SMA (Single Pack)
  • MTDOT-915-X1-UFL-1 mDot 915 MHz XBee LoRa UFL (Single Pack)
  • MTDOT-915-X1P-SMA-1 mDot 915 MHz XBee LoRa SMA w/Programming Header

And is this the antenna you speak of? http://www.semiconductorstore.com/cart/pc/viewPrd.asp?idproduct=50702


(Manuel Betancurt) #9

hI Andrew,
thanks for the response,

Ok back now with the TTN!,
I have an arduino Uno, and an eleven,
i put the xbee shield, and load this firmware:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX



void setup() {
  // put your setup code here, to run once:

  Serial.begin(115200);
  while (!Serial) {
 
   }


  Serial.println("started");

  mySerial.begin(115200);
  mySerial.println("AT");
}

void loop() {
  if (mySerial.available()) {

      Serial.print(mySerial.read());

  }
  if (Serial.available()) {

      Serial.print(Serial.read());

  }
}

but on serial response i get:

started
16325310610131179751310131310

I also tried leaving blank sketch as suggested, but i get no response at all,

I will by a db9 to usb cable and try with the mDot multitech programmer kit tomorrow,

Any suggestion please to make the AT response "OK" :]
thanks!


(Andrew Maggio) #10

Hi Manuel. Change the occurrences of Serial.print to Serial.write


(Manuel Betancurt) #11

Yay Andrew!
"OK" showing now!, thanks!

Now will start communication with gateway! ... fingers crossed :}


(Manuel Betancurt) #12

Hi Andrew, thanks ok so this is the status, OK showing on serial port using arduino, on mac

got DB9 serial to USB cable

only worked so far on windows, so with the UDK, and using terminal program, can send commands AT to the LoRa module,

now other question please,

Thanks for the commands...

    at+pn=1 // Set Public Network to true
    at+njm=0 // Set Network Join Mode to manual
    at+fsb=7 // Set Frequency Sub Band to whatever your Conduit is set to. Mine is 7
    at+ack=0 // Turn off acknowledgements (not supported by TTN yet)
    at+na=12345678 // Pick a number. This is the node address and should be unique for each node.
    at+nk=0,2B7E151628AED2A6ABF7158809CF4F3C // Set Network Key for TTN
    at+nsk=2B7E151628AED2A6ABF7158809CF4F3C // Set Network Session Key for TTN
    at+dsk=2B7E151628AED2A6ABF7158809CF4F3C // Set Data Session Key for TTN.
    Then issue:
    at+join
    at+send=HelloWorld

here I dont know where i did set sub band,

at+fsb=7 // Set Frequency Sub Band to whatever your Conduit is set to. Mine is 7

where is this network key, session key, data session key?

at+nk=0,2B7E151628AED2A6ABF7158809CF4F3C // Set Network Key for TTN
at+nsk=2B7E151628AED2A6ABF7158809CF4F3C // Set Network Session Key for TTN
at+dsk=2B7E151628AED2A6ABF7158809CF4F3C // Set Data Session Key for TTN.

how to get the band and the keys?
where is this configured on the gateway?

Thanks!

Getting there :stuck_out_tongue:


(Manuel Betancurt) #13

Hey @maj Thanks a lot for the guidance!, I changed some things! now connected using DB9 cable, sending commands that way, next AT ardu and raspi, Chat soon... Thanks! :}


(Paul) #14

hey Manuel, have you got the LoRa gateway and network up and running in Sydney?
I'm keen to connect to others in Sydney who are interested in this space.
Cheers
Paul


(Manuel Betancurt) #15

hi @Pcandy, yes! I got one running on Surry hills, @maj have a some more around Sydney https://thethingsnetwork.org/c/sydney/ Chat soon :}


(Andrew Maggio) #16

FYI These commands are no longer valid since we now use the Australian band plan and also since TTN has moved to the new back end.

New commands to use on Multitech mDot's are (for OTAA):
at+pn=1
at+njm=1
at+fsb=2
at+ack=0
at+ni=0,your_app_id
at+nk=0,your_app_key
at+join
at+send=HelloWorld


(Ivanrakilovsky) #18

Hi.

I have an Arduino Uno so I am using SoftwareSerial to talk to mDot.
mDot flashed with AT Command Firmware v 3.0.0

I can write to the mDot serial, connect to TTN - no problem with that.
But when I try to read data from the serial port it is scrambled and some parts are missing.

SoftwareSerial xBee(10, 11); // RX, TX

void setup() {
Serial.begin(115200);
delay(200);
xBee.begin(115200);
xBee.println("ATI");
}

void loop() {
if (xBee.available() > 0) {
Serial.write(xBee.read());
}
}

Result (sometimes it is different):
Q)5)MultiTech mDot
mFirmware : 3.0.0-mbed144
Library : 3.0.0-

I have tried changing the baud rate on the mDot to 9600 instead of the default one, in case SoftwareSerial does not support 115200, but it did not help either.

I know it is an old thread, but it seems to be popular.
What am I doing wrong? Does anyone have similar issues?

Thanks,
I.R.


(Andrew Maggio) #19

I've had limited success with Software Serial. You could try AltSoftSerial (https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html) which seems to be much more stable.


(Ivanrakilovsky) #20

Thank you for the suggestion.
I have tried AltSoftSerial, the result was slightly better, but again not really reliable.
I ended up using an Arduino Mega and hardware serial instead.

Even with the Mega I had to lower the baud rate of the mDot to 19200.
But that works for me now.

At some point I might just replace the AT firmware and return just a few bytes (fixed length) for status codes.
Or, Is there a way to turn off all the messages in the factory AT firmware and just read the statuses e.g. OK, ERROR?


(Andrew Maggio) #21

Seems strange that you still have problems, even with Hardware Serial. I run mDots mainly on Arduino Leonardos (so hardware serial) and have no problems at 115200 baud with AT firmware v2.x. I haven't tried v3 yet.

You could try @shaun's mDot Library.