Communication waspMote and Arduino

Everything about programming the platform and using the Waspmote API
Post Reply
Posts: 25
Joined: Tue Jul 23, 2019 10:47 am
Company: IBEC

Communication waspMote and Arduino

Post by jburgues » Wed Jul 31, 2019 1:12 pm

Good morning,

I'm trying to connect an Arduino Mega 2560 and a WaspMote PRO v1.5 so that the values from 16 sensors installed on the Arduino shield are transmitted to the waspMote upon request from the waspMote. Thus, Arduino acts as a slave and Waspmote as a master.

I have initially tried it using I2C protocol. The waspMote (master) sends an command to the Arduino (slave), which responds with a Wire.write(data) where data is an integer array of size 16.

The problem is that the waspMote only receives the first 8 values (see Serial monitor for receiver/sender here:

See also my code:

I am aware that I2C buffer in Arduino is by default limited to 32 bytes, due to the constants BUFFER_LENGTH 32 in Wire.h and TWI_BUFFER_LENGTH 32 in twi.h (Indeed, I found the latter one is the only one which actually matters). But this should not be a problem since in ATMega boards each Integer is 2 bytes of size ( ... types/int/)

Therefore, my question is: Which is the size of the receiving I2C buffer in waspMote? Is it limited to 16 bytes?

If the buffer size is not the problem, do you have any clue on what is the problem and how to solve it?

My second question is: Can I use UART or SPI instead of I2C to perform this data transmission? I am asking this because I see in the documentation that UART0 is shared with Socket0 (which I currently use for XBee), UART1 is shared with GPS (and I'm using GPS from the 4G module) and SPI is dedicated to Micro SD Card (which I might use as well). Are modules using shared ports (e.g., XBee) intelligent enough to switch the MUX to the correct position before using it?

Thanks a lot!

Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: Communication waspMote and Arduino

Post by libelium-dev » Thu Aug 01, 2019 8:53 am

Hi jburgues,

We don't know which could be the issue in the I2C communication, we should investigate the codes and libraries deeply to know what is going on. In any case, we recommend to use UART communication, it will be easier.

You can use the mux of the UART to select the correct position before using it. You have an example about how to manage the auxiliary UARTs ... ary-uarts/

Hope this help.


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest