Différences entre versions de « ADAFRUIT-FONA-Arduino-Test »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
Ligne 91 : Ligne 91 :
  
 
{{ADFImage|ADAFRUIT-FONA-Arduino-Test-54.jpg}}
 
{{ADFImage|ADAFRUIT-FONA-Arduino-Test-54.jpg}}
 +
 +
== PWM/Buzzer ==
 +
There is a single PWM output pin that you can use to control a Piezo or a vibrating motor. The datasheet is a little unclear on how to use it in 'PWM' mode where you have full frequency and duty cycle control. In the mode we're using it, you can set the frequency from 1-2000 Hz and it will have 50% duty cycle. The '''PWM''' pin is the straight-from-the-module output, 2.8Vpp. The Buzzer pins have a PNP driver, so you can use it with a motor buzzer and power from the lipoly battery.
 +
 +
{{ADFImage|ADAFRUIT-FONA-Arduino-Test-55.jpg}}
 +
 +
== Faire un appel ==
 +
OK now we're onto the good stuff. You can make a phone call with FONA pretty easily. Make sure you have the right audio interface selected (external or headset!) before you go forward
 +
 +
Make a call with '''c''' - the call happens in the 'background'. When you're done then you can hang up with '''h'''
 +
 +
{{ADFImage|ADAFRUIT-FONA-Arduino-Test-56.jpg}}
 +
 +
== Envoyer et recevoir des SMS ==
 +
Another easy thing you can do is send and receive SMS messages. Lets start by sending an SMS. We'll use twitter's 40404 short code, which will auto respond, making it easy to verify both sending and receiving
 +
 +
You can send multi-line SMS's using the library API but for this example, its easier to parse the data if its a single line!
 +
 +
{{ADFImage|ADAFRUIT-FONA-Arduino-Test-57.jpg}}
 +
 +
You can then ask the SIM how many SMS's it has with '''N''' and read all of them with '''R'''
 +
 +
Note that SMS's are referred to by slots but the number does not include empty slots. We'll show this in detail in a bit
 +
 +
{{ADFImage|ADAFRUIT-FONA-Arduino-Test-58.jpg}}
 +
 +
You can read individual SMS's with '''r'''
 +
 +
{{ADFImage|ADAFRUIT-FONA-Arduino-Test-59.jpg}}
 +
 +
And delete SMS's by slot # with '''d'''
 +
 +
{{ADFImage|ADAFRUIT-FONA-Arduino-Test-60.jpg}}
  
  

Version du 20 novembre 2015 à 13:17


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Préambule

Télécharger Adafruit_FONA

To begin reading sensor data, you will need to télécharger la bibliothèque Adafruit_FONA depuis le dépôt github. You can do that by visiting the github repo and manually downloading or, easier, just click this button to download the zip

Download-icon.pngTéléchargez la bibliothèque Adafruit_FONA

Rename the uncompressed folder Adafruit_FONA and check that the Adafruit_FONA folder contains Adafruit_FONA.cpp et Adafruit_FONA.h

Place the Adafruit_FONA library folder your arduinosketchfolder/libraries/ folder.

You may need to create the libraries subfolder if its your first library. Restart the IDE.

Nous disposons d'un tutoriel pour l'installation de bibliothèque si vous avez besoin d'un petit coup de main.

Charger la démo

Open up File->Examples->Adafruit_FONA->FONAtest and upload to your Arduino wired up to the module.

For Mega, Leonardo, or Micro, change the definition of FONA_TX to the pin you used!

ADAFRUIT-FONA-Arduino-Test-10.png
Crédit: AdaFruit Industries www.adafruit.com

Make sure you have a charged 3.7/4.2V LiPoly or LiIon battery plugged into the JST and an antenna attached

ADAFRUIT-FONA-Arduino-Test-11.jpg
Crédit: AdaFruit Industries www.adafruit.com

ADAFRUIT-FONA-Asm-20.jpg
Crédit: AdaFruit Industries www.adafruit.com

Once uploaded to your Arduino, open up the serial console au débit de 115200 bauds to begin the tester sketch

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

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.

Utiliser ce Croquis

The test sketch has a menu interface so you can test out just about everything the FONA can do. The menu may change slightly as we add more functionality and update code!

Tension de l'accu

Lets begin by reading the battery voltage. That's the lipoly battery. This is handy if you need to track when the battery is low! type b into the command window et presser le bouton Send (envoi)

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

You'll see a print-out of the battery voltage in mV, so in this case its 3.726V

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Vérifier le CCID de la carte SIM

You can verify that the SIM is inserted and correct by reading the CCID, which is the unique identifier printed on it with C.

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Vérifier le RSSI (force du signal)

You can ask the FONA for the signal strength with the command i. The reply is a number, but you can convert it to dBm. Try to have the signal strength higher than 5 in order to make calls, SMSs, etc. In this case, I've got a 10

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Vérifier l'enregistrement réseau

If the FONA has good signal it will immediately try to locate a cell tower and register to it.

You can check the status of the network with n

Once it's Home Registered, give it like 5-10 more seconds before trying to access/send SMS's or phone calls.

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Volume audio

You can set the audio volume with v and retrieve it with V - its in % so ranges from 0 to 100

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Casque Audio et Audio externe

There are two audio paths on the FONA. One is the headset, thru the 3.5mm audio jack. The other is "external" - using the two speaker and mic pins for wiring up external speaker and mic. FM audio, phone calls, tones, etc can be routed to one or the other.

  • To set the audio to headset, use the command H
  • To set the audio to external, use the command e

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Jouer des sons (tonalités)

You can test the audio path with the toolkit tones. These are tones that mimic what some phone services sound like. For a full list of tones, you can check the AT+STTONE command in the AT command datasheet. We'll use tone #20 which is the American dial tone.

You can switch to headset mode, play a tone, then try it on the external audio mode. This is a very easy way to try out both speakers for debugging

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

PWM/Buzzer

There is a single PWM output pin that you can use to control a Piezo or a vibrating motor. The datasheet is a little unclear on how to use it in 'PWM' mode where you have full frequency and duty cycle control. In the mode we're using it, you can set the frequency from 1-2000 Hz and it will have 50% duty cycle. The PWM pin is the straight-from-the-module output, 2.8Vpp. The Buzzer pins have a PNP driver, so you can use it with a motor buzzer and power from the lipoly battery.

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Faire un appel

OK now we're onto the good stuff. You can make a phone call with FONA pretty easily. Make sure you have the right audio interface selected (external or headset!) before you go forward

Make a call with c - the call happens in the 'background'. When you're done then you can hang up with h

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Envoyer et recevoir des SMS

Another easy thing you can do is send and receive SMS messages. Lets start by sending an SMS. We'll use twitter's 40404 short code, which will auto respond, making it easy to verify both sending and receiving

You can send multi-line SMS's using the library API but for this example, its easier to parse the data if its a single line!

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

You can then ask the SIM how many SMS's it has with N and read all of them with R

Note that SMS's are referred to by slots but the number does not include empty slots. We'll show this in detail in a bit

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

You can read individual SMS's with r

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

And delete SMS's by slot # with d

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com


https://learn.adafruit.com/adafruit-fona-mini-gsm-gprs-cellular-phone-module/arduino-test#checking-network-registration


Source: Adafruit FONA - Call phones, send and receive SMSs, & more! All with FONA. Ecrit par Lady Ada pour AdaFruit. Crédit AdaFruit Industries

Traduit par Meurisse D. pour MCHobby.be

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com

Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : «  Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.

L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.