Here's the device in action:
Assembly of the gadget is fairly easy, but the project must have an external power supply AND a battery. It also only works properly on the Arduino Mega2560 (other options were tried).
Parts Required:
- Emic2 text to speech module
- Arduino Mega 2560
- Adafruit SIM800L module
- RtcDS3231 module
- 5v power supply
- 1000 mAH LiPo battery
- Speaker
- GPRS aerial
- Ufl to SMA aerial connector
Technical Connections:
- Mega SCL to DS3231 SCL
- Mega SDA to DS3231 SDA
- Mega D12 to Emic2 Sin
- Mega D11 to Emic2 Sout
- Mega D10 to Fona Tx
- Mega D9 to Fona Rx
- Fona Key to ground
- Fona 5v (in the middle of the board) to 5v
- Fona Vio to 5v
Other than the above, it's all pretty obvious. The Emic 2 has SP- and SP+ for the speaker. Connect all the modules to 5v and ground as indicated on the modules themselves.
So, with the hardware rigged up, it's just a matter of uploading code to the Arduino and creating a PHP file to read the weather station database.
The really great thing about this project is that you don't actually need your own weather station or PHP server as you can just read mine - no usernames or passwords required! Just set up the hardware as above and upload the following code to the Arduino Mega:
#define rxPin 11 // Serial input (connects to Emic 2's SOUT pin)
#define txPin 12 // Serial output (connects to Emic 2's SIN pin)
#define ledPin 13 // Most Arduino boards have an on-board LED on this pin
#include "Adafruit_FONA.h"
#define FONA_RX 9
#define FONA_TX 10
#define FONA_RST 4
#include <SoftwareSerial.h>
// CONNECTIONS:
// DS3231 SDA --> SDA
// DS3231 SCL --> SCL
// DS3231 VCC --> 3.3v or 5v
// DS3231 GND --> GND
#if defined(ESP8266)
#include <pgmspace.h>
#else
#include <avr/pgmspace.h>
#endif
int i;
int hobbits;
int orks;
#include <Wire.h> // must be included here so that Arduino library object file references work
#include <RtcDS3231.h>
RtcDS3231<TwoWire> Rtc(Wire);
char datestringB[20];
// this is a large buffer for replies
char replybuffer[255];
char url[80];
#include <SoftwareSerial.h>
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
SoftwareSerial *fonaSerial = &fonaSS;
SoftwareSerial emicSerial = SoftwareSerial(rxPin, txPin);
Adafruit_FONA fona = Adafruit_FONA(FONA_RST);
uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout = 0);
uint8_t type;
int switchStatus=0;
int smsnumB=1000;
String textMessage;
String textMessageShort;
int previousNum =0;
int smsNumberStatus=0;
int z=0;
int p=0;
int selectSMS=0;
int speakStatus=0;
String d;
String nothing;
char webpage[1000];
int g=0;
void setup()
{ Serial.begin(9600);
Serial.print("compiled: ");
Serial.print(__DATE__);
Serial.println(__TIME__);
//--------RTC SETUP ------------
Rtc.Begin();
RtcDateTime compiled = RtcDateTime(__DATE__, __TIME__);
printDateTime(compiled);
Serial.println();
RtcDateTime now = Rtc.GetDateTime();
// while (!Serial);
Serial.println("Hello There!");
pinMode(LED_BUILTIN, OUTPUT);
pinMode(ledPin, OUTPUT);
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
emicSerial.begin(9600);
emicSerial.print('\n'); // Send a CR in case the system is already up
while (emicSerial.read() != ':'); // When the Emic 2 has initialized and is ready, it will send a single ':' character, so wait here until we receive it
delay(10); // Short delay
emicSerial.flush(); // Flush the receive buffer
pinMode(4, INPUT_PULLUP); // Use this to reset Fona.
digitalWrite(4, HIGH);
delay(100);
digitalWrite(4, LOW);
Serial.println(F("FONA basic test"));
Serial.println(F("Initializing....(May take 3 seconds)"));
fonaSerial->begin(4800);
if (! fona.begin(*fonaSerial)) {
Serial.println(F("Couldn't find FONA"));
//emic.speak("Bad news .. We could not find the Fona .. Please reset all devices");
while (1);
}
emicSerial.println("P1");
emicSerial.println("V12"); // 18 is max.
emicSerial.print('S');
emicSerial.print(("Good news .. All systems are fully operational."));
emicSerial.print('\n');
//emic.speak("Good news .. we successfully connected with the Fona...
Read more »