MKR 1500 + MKR Connector starting from 0

Hello!

I feel like stupid asking this question but I'm completely lost! I start working with Arduino Pro Mini couple weeks ago to create an IoT working with some different modules like GSM / GPS / Pressure Sensor / NFC and Servo.

My first stage was to try the feasibility of the project. And it works! My second step is to make a first working prototype. I decide to order the Arduino MKR NB 1500 for low consumption and MKR Grove connector for easy installation. Unfortunately I'm not able to make it works!

I was using some script including SoftwareSerial.h library witch is not available for MKR platform. So I'm not able to use the same code. I decide to start again from 0 but can't find any documentation / tutorial for MKR platform to be able to understand how to work/replace SoftwareSerial.h.

For example, I'm using the Grove GPS from Seed Studio who provide an code example for Arduino (using SoftwareSerial.h). How can I define RX / TX pin? How can I communicate with?

The only function that I can still make works is the Servo with Servo.h.

Unfortunately, seems that there is very less documentation, tutorial, post about MKR as UNO / Pro Mini... Should I go back to an another platform?

Thank you in advance.

Hello

Forget SoftwareSerial.h on this board. It's with a SAMD21 Chip. You have a predefined UART interface RX / TX, PIN 13/14. It's also possible to ad more UART interfaces with the SERCOM functionality, but that's step two..
If you need just one Serial Interface, it's very easy:

From the Arduino Tutorial:

Serial ports on the MKRZero
The MKRZero has a number of facilities for communicating with a computer or other microcontrollers. The USB connector exposes as a virtual serial port that can be controlled by writing and reading to the Serial object. Pins 13/14, instead, expose a Hardware serial port mapped to Serial1 object. Opening and closing the USB Serial port at a baud rate other than 1200bps will not reset the 101. To use the serial monitor, and see what your sketch does from the beginning, you'll need to add few lines of code inside the setup(). This will ensure the Curie module will wait for the serial port to open before executing the sketch:

while (!Serial) ;

Pressing the Reset button on the MKRZero causes the microcontroller to reset as well as resetting the USB communication.
This interruption means that if the serial monitor is open, it's necessary to close and reopen it to restart the communication.

Hi Instarep,

Thank you for the information. Even if I check out this tutorial before, you open my mind and I think that I understand how it works now.

My question that is still not clear to me. Should I need to work with multiple Serial and what is the meaning of "Serial" exactly.

I have :

  • 4 pressure sensor analog (So I suppose it work on I2C) - ABPDANV150PGAA5
  • 4 servo grove analog (or different). It's I2C also?
  • Grove GPS = UART
  • Grove NFC I2C or UART
  • Grove RFID = UART
  • SARA-R4 NB-IOT (already included on MKR 1500 NB) but work with UART and I2C

I2C can use the same "pin" but what about UART? My MKR connector have 14 grove slots. My idea was to connect every module using etch slots. A0 to A6 and D0 to D6.

Analog is all I2C and D = UART? And I have to make the "connection" with Wire.h as describe in this tuto:

Sorry I'm maybe to beginner for those things in electronics.

Thank you in advance for your support.

Hi Tuxmountain

Sorry for my late answer, i lost your signal on my radar.
First of all: You will understand everything, it's easy, you just have a knot in your brain, don't get discouraged, to understand all these thing Arduino was built!
I'll try to explain on you sensors:

  • The Pressure sensor gives out on its signal pin a voltage depending on pressure. Between 0 and 3.3 V or 0 and 5 V
    for example. Anyway, these signals are named analog because the voltage can be any in the full range. Now you want to read from the sensor so you have analogRead() that pin and you get a number representing the voltage.
    Because the voltage on analog pins can be 0 or 5 these pins can be used as digital pins but digital pins can not be used as analog pins!
  • Digital is High Voltage (Lets say 3 V meaning On, 1 or True) OR Low Voltage (Let's say 0.1 V meaning OFF, 0 or False),
    basically 0 or 1. Now with the binary system you write number with these 0 and 1.
  • A serial connection is now digital signals on one wire 0 or 1, Low Voltage or High Voltage in a predefined speed (Baud Rate) to communicate. On a UARTserial connection you have a wire for each direction (RX and TX)
  • I2C is a advanced standard communication protocol formed as a BUS but based also on digital signals on digital pins.
    Now your arduino is providing a number of analog and digital pins (GPIO = general purpose input output) and they can be defined as you wish. The guys from Arduino predefined UART and I2C on some pins to make things easy but these definitions can be changed. In your case you can use all the predefined pins:
    Pressure Sensors as Analog A0, A1 ...
    NFC on I2C BUS
    GPS on a Digital Port (The Grove Library does all the setup work for you)
    RFID on UART
    The modem SARA-R4 has its own serial interface predefined by Arduino nothing to do for you, the Arduino MKRNB Library does all the work for you.

Maybe my post is confusion you even more, i'm not a good teacher... There are some very good tutorials with the Adafruit or Arduino Website, check them out.

But in general: All these things look very complicated at first sight, they are not! (They become complicated at the third sight to be honest)
Again: Arduino is made to learn all these things. Everyone on this forum will agree with me when i say that it's absolutely normal and common to sometimes turn into the wrong street and end up in a swamp. Two steps forward one step back...