Caixa niu, Pep Gener

De Wikijoan
Dreceres ràpides: navegació, cerca

Contingut

Introducció

Finalment hem comprat la 3G/GPRS/GSM Shield for Arduino with GPS - European version SIM5320E

(compte, aquesta és la versió americana. Nosaltres tenim la europea). Però aquest enllaç em proporciona un bon punt de partida.

TinySine SIM5320X 3G shield has better coverage, GSM backwards-compatibility and even sports a built-in GPS module for geolocation & asset tracking. This all-in-one cellular phone module with that lets you add location-tracking, voice, text, SMS and data to your project in a single shield.

This shield packs a surprising amount of technology into it's little frame. At the heart is a powerfull GSM cellular module with integrated GPS. On its own, this shield can't do anything. It requires a microcontroller to drive it! We suggest and use an Arduino but any 3-5V microcontroller with a UART can send and receive commands over the RX/TX pins.

Per tant, queda clar que a part de l'Arduino també el podem connectar a la Raspberry Pi, que ens ofereix els pins RX/TX. La idea és que des del microcontrolador enviem comandes AT cap al mòdul. Aquestes comandes AT tant poden ser per enviar SMS, per fer una trucada, o bé per enviar dades.

Es pot videostreaming?

Aspectes d'amplada de banda i velocitat a l'hora d'enviar dades.

Important llegir l'apartat Does make sense a 3G module for a low speed microcontroller device such as Arduino?.

Apartat 4. Bandwidth

3G module connected with Arduino allows downlinks rates over 115200 bauds (~11.5KBps), the maximum UART's speed and uplinks rates over 30000 bauds (~3KBps). Using the module as 3G USB modem we got speeds of 2Mbps (~222KBps) for downlink and 0.7Mbps (~77KBps) for uplink and. The connection speed may vary depending on the state of the network, the quality of the signal and the carrier.

1a prova amb Arduino. Enviar SMS

L'objectiu és fer les primeres proves amb Arduino. Després hauré de traslladar els coneixements a la Raspberry Pi.

El primer que he de fer és descarregar l'Arduino library, i seguir la Quick Start Guide:

STEP1: Install Library

To begin reading sensor data, you will need to Install Library as follows:

nota: **This library requires Arduino v1.0.6 or higher**

STEP2: 3G Baud Adjustment

If you have a Tinysine 3G shield, the first time you use it you may need to run the FONA3G_setBaud example to set the baud rate manually to 4800bps rather than 115200.

Stack your 3G shield on the Arduino main board,then plug in the USB cable from your computer to the Arduino board. We'll be using software serial to talk with the module,set TX-2,RX-3 on the 3G shield. And press the small POWER button for 4/5 seconds to power on.

Select your board type and serial port from the Tools menu,Open up File->Examples->Adafruit_FONA->FONA3G_setbaud and upload to your Arduino wired up to the module.

Once uploaded to your Arduino, open up the serial console at 115200 baud speed to begin the tester sketch.

NOTA. Hem de distingir entre la comunicació sèrie entre l'ordinador i l'arduino, que serà de 115200:

  Serial.begin(115200);

i la comunicació entre l'arduino i el mòdul 3G, que volem que sigui baixa (4800):

  // send the command to reset the baud rate to 4800
  fona.setBaudrate(4800); 

Com es comenta en l'exemple, ...since the FONA 3G does not do auto-baud very well, this demo fixes the baud rate to 4800 from the default 115200.

STEP3: Send SMS Test

In order to use the phone parts of 3G shield you will need a 2G or 3G Mini SIM card. Insert a Mini SIM card in the SIM card holder on the back, and connect the GSM antenna. Put the 3G shield on the Arduino board,then plug in the USB cable from your computer to the Arduino board.

We'll be using software serial to talk to the module,we choose TX—2,RX—3 on the 3G shield. And press the small POWER button for 4/5 seconds to power on.

Select your board type and serial port from the Tools menu, Open up File->Examples->Adafruit_FONA->FONAtest and upload to your Arduino wired up to the module.

Once uploaded to your Arduino, open up the serial console at 115200 baud speed to begin the tester sketch.

Enter the s in the send column and click send. Serial monitor will print output Send to #, then enter the phone number you want to send and click send. Finally enter the message you want to send and click send.

Note: Make sure you also have Both NL & CR for the serial command sender option. This means when you send data to the Arduino via the console, it will put a newline/return at the end.

STEP4: GPS Test -> això de moment no ho faig

Proves amb la Raspberry Pi


creat per Joan Quintana Compte, juny 2017

Eines de l'usuari
Espais de noms
Variants
Accions
Navegació
IES Jaume Balmes
Màquines recreatives
CNC
Informàtica musical
joanillo.org Planet
Eines