# Arduino with xbee shield + mDot

**URL:** <https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311>\
**Category:** MultiTech Gateways\
**Created:** [February 22, 2016, 7:26am UTC](https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311 "2016-02-22T07:26:38Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![yurbaggio](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/y/b5e925/32.png) [@yurbaggio](https://www.thethingsnetwork.org/forum/u/yurbaggio)\
**Post date:** [February 4, 2018, 12:15pm UTC](https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311/22 "2018-02-04T12:15:49Z")

</div>

I’m doing the same thing with the same devices. I can’t receive the ‘OK’ on the Serial monitor, when sending ‘AT’. I want to know where is the problem and how did you success. I’m looking for your reply.

---

<div class="post-metadata">

**Author:** ![yurbaggio](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/y/b5e925/32.png) [@yurbaggio](https://www.thethingsnetwork.org/forum/u/yurbaggio)\
**Post date:** [February 4, 2018, 12:25pm UTC](https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311/23 "2018-02-04T12:25:44Z")

</div>

I use an Arduino Uno with XBee and mdot. I connect them together, but I can’t receive the ‘OK’ on the Serial monitor, when sending ‘AT’. What should I do first? I wonder whether I miss some step.

---

<div class="post-metadata">

**Author:** ![yurbaggio](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/y/b5e925/32.png) [@yurbaggio](https://www.thethingsnetwork.org/forum/u/yurbaggio)\
**Post date:** [February 4, 2018, 12:46pm UTC](https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311/24 "2018-02-04T12:46:37Z")

</div>

Here I see you help everyone. I use the same devices as theirs, and I have the same problem. As you told them did, I did. But it didn’t work. I hope I can get help from them. How can I get his email as you did on the second floor. My email is [yu.han2@jcu.edu.au](mailto:yu.han2@jcu.edu.au). Thanks.

---

<div class="post-metadata">

**Author:** ![ivanrakilovsky](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ivanrakilovsky/32/6072_2.png) [@ivanrakilovsky](https://www.thethingsnetwork.org/forum/u/ivanrakilovsky)\
**Post date:** [March 6, 2018, 11:31am UTC](https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311/25 "2018-03-06T11:31:54Z")

</div>

@yurbaggio  
Hi, my experience with Arduino Uno was not great.  
Basically you have to use Software Serial to talk to the mdot, because Uno has only on serial.  
I had much better experience with Arduino Leonardo as it has additional HW Serial.

In your case make sure you have set the correct baud rate - the default is 115200 on the mdot.  
I would suggest - reduce the baud rate on the mdot - connect it via the mtech dev board and change it to something lower as the Software Serail library does not support 115200 or at least not reliably.

Then you have to use the Software Serial Port to talk to the mdot board and you can listen with the Monitor on the default HW Serial port for some output.

---

<div class="post-metadata">

**Author:** ![andy14](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/andy14/32/17798_2.png) [@andy14](https://www.thethingsnetwork.org/forum/u/andy14)\
**Post date:** [October 22, 2018, 4:29pm UTC](https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311/27 "2018-10-22T16:29:00Z")

</div>

I’ve got a mDot connected to TTN with an Arduino Uno, however I need the addition resources available from the Arduino Mega. When I tried porting the Uno code over and removing the software serial library, I no longer see any serial data in the serial monitor. Any thoughts?

---

<div class="post-metadata">

**Author:** ![BoRRoZ](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/borroz/32/44234_2.png) [@BoRRoZ](https://www.thethingsnetwork.org/forum/u/BoRRoZ)\
**Post date:** [October 22, 2018, 4:34pm UTC](https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311/28 "2018-10-22T16:34:35Z")

</div>

> [@andy14](#):
>
> Any thoughts?

a code error ?

---

<div class="post-metadata">

**Author:** ![andy14](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/andy14/32/17798_2.png) [@andy14](https://www.thethingsnetwork.org/forum/u/andy14)\
**Post date:** [October 23, 2018, 4:50pm UTC](https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311/29 "2018-10-23T16:50:47Z")

</div>

My code for the mDot using an xBee shield and an Arduino Mega is the following:  
//  
void setup()  
{  
Serial.begin(9600); //configure serial port  
Delay(1000); // 1 second delay to allow mDot to boot  
Serial.send(AT+JOIN); //OTA to join TTN  
Delay(500);  
Serial.read(); //read response message from mDot  
}

void loop()  
{  
if (Serial.available())  
{  
Serial.send(AT+SEND = Hello World); // Command data send to mDot  
Delay(500);  
Serial.read(); // read response message from mDot  
Delay(500);  
}  
else  
{  
Serial.println(“error”);  
}  
}  
//

Note that I have already configured the mDot previously to have a baud rate of 9600 along with the App EUI and App Key.

---

<div class="post-metadata">

**Author:** ![andy14](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/andy14/32/17798_2.png) [@andy14](https://www.thethingsnetwork.org/forum/u/andy14)\
**Post date:** [October 23, 2018, 5:00pm UTC](https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311/30 "2018-10-23T17:00:23Z")

</div>

> [@ivanrakilovsky](#):
>
> I ended up using an Arduino Mega and hardware serial instead.

Would you be able to share your Mega code for the mDot? I had it working on the Uno but and struggling getting it on the Mega for some reason.

---

<div class="post-metadata">

**Author:** ![ivanrakilovsky](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ivanrakilovsky/32/6072_2.png) [@ivanrakilovsky](https://www.thethingsnetwork.org/forum/u/ivanrakilovsky)\
**Post date:** [November 7, 2018, 2:35pm UTC](https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311/31 "2018-11-07T14:35:51Z")

</div>

Hi Andy.

It is probably too late now - I’ve been very busy last two weeks and wasn’t looking at the forums.  
Anyway - you could try this library:

> **[ShaunPrice/LoRamDot](https://github.com/ShaunPrice/LoRamDot)**
>
> Contribute to ShaunPrice/LoRamDot development by creating an account on GitHub.

Have in mind the default baud rate for the mDot is 115200 and unless you have changed it you should use that.

The Arduino Mega has three additional serial ports: Serial1 on pins 19 (RX) and 18 (TX), Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX). So be sure you have connected your xbee shield to the correct serial - e.g. Serial1.

Without the library you could do something like that:  
Assuming you have connected to Serial1 and you have kept the default baud rate:  
void join() {  
Serial.println(“join”);  
// wake up  
Serial1.println(“AT”);  
// use factory defaults  
Serial1.println(“AT&F”);  
// public network mode  
Serial1.println(“AT+PN=1”);  
// network join OTAA  
Serial1.println(“AT+NJM=1”);  
// set AppEUI  
Serial1.println(“AT+NI=0,” + appEui);  
// set AppKey  
Serial1.println(“AT+NK=0,” + appKey);  
// application data port  
Serial1.println(“AT+AP=2”);  
// join  
Serial1.println(“AT+JOIN”);  
}

void send(String msg) {  
Serial.println(“send”);  
// send data  
Serial1.println(“AT+SEND=” + msg);  
}

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

Sorry for the late answer.  
Cheers,  
Ivan

---

<div class="post-metadata">

**Author:** ![ivanrakilovsky](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/ivanrakilovsky/32/6072_2.png) [@ivanrakilovsky](https://www.thethingsnetwork.org/forum/u/ivanrakilovsky)\
**Post date:** [November 7, 2018, 2:38pm UTC](https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311/32 "2018-11-07T14:38:12Z")

</div>

Also check if you have properly connected TX from the xbee shield to RX on the mega and RX to TX respectively.

---

<div class="post-metadata">

**Author:** ![seedteam6uav](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/seedteam6uav/32/35697_2.png) [@seedteam6uav](https://www.thethingsnetwork.org/forum/u/seedteam6uav)\
**Post date:** [November 7, 2021, 3:08am UTC](https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311/33 "2021-11-07T03:08:34Z")

</div>

Not sure if anyone will reply to this but I have been following this thread and still coming up short.

I am trying to configure an mdot chip to work with an arduino mega through an xbee shield. I think it has something to do with the way I have my serial pins set up as the shield I am using does not actually connect to the serial1 ports on the mega.

I have tried various setups including running wires straight from the board to the mdot without using the shield but still have not been able to receive any output when entering commands through the serial monitor.

Any tips would be appreciated as I am very new to this

[Previous page](https://www.thethingsnetwork.org/forum/t/arduino-with-xbee-shield-mdot/1311.md?page=1)
