Update Online Database using GSM/GPRS Shield

lakindu93
Sergeant
Sergeant
Posts: 21
Joined: Wed Jun 26, 2013 12:45 pm
Location: Colombo

Re: Update Online Database using GSM/GPRS Shield

Post by lakindu93 » Sat Sep 20, 2014 8:13 pm

SemiconductorCat wrote:
lakindu93 wrote:?? PC ???? ????? host ???? ????? mysql database server (local database ????), EFcom GPRS/GSM shield ?? ???????? ???? access ????? ??????? ?? ??????? ??? ?????? ?????? ???? idea ???? ????????...

Directly.
First you need to shift your database server into your DMZ zone and then enable it for the world.
Then you need to forward the mysql port in your router. Probably your router would support this option with a nice web based router GUI.

Then your ardino directly connect to that server using that connection.

Code: Select all

/**
* Example: Hello, MySQL!
*
* This code module demonstrates how to create a simple 
* database-enabled sketch.
*/
#include "SPI.h"
#include "Ethernet.h"
#include "sha1.h"
#include "mysql.h"

/* Setup for Ethernet Library */
byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress server_addr(10, 0, 1, 23);

/* Setup for the Connector/Arduino */
Connector my_conn; // The Connector/Arduino reference

char user[] = "root";
char password[] = "secret";
char INSERT_SQL[] = 
 "INSERT INTO test_arduino.hello VALUES ('Hello, MySQL!', NULL)";

void setup() {
  Ethernet.begin(mac_addr);
  Serial.begin(115200);
  delay(1000);
  Serial.println("Connecting...");
  if (my_conn.mysql_connect(server_addr, 3306, user, password))
  {
    delay(500);
     /* Write Hello, World to MySQL table test_arduino.hello */
     my_conn.cmd_query(INSERT_SQL);
     Serial.println("Query Success!");
  }
  else
    Serial.println("Connection failed.");
}

void loop() {
}
There is another way to do this using a web service or HTTP front end. In that way they
are using "onewire" library.In that way you don't need to do port forwarding or risk your database zone in
a DMZ zone.

src: http://drcharlesbell.blogspot.com/2013/ ... ino_6.html

If this is a short range application like solar plant monitoring , then why didn't you use ethernet or wifi
instead.Wi fi is long term beneficial. And remind you something, sometimes you may need to save your readings
in a SD card like thing in a case where connection is loss or server down. My friend who implemented a solar based
monitoring client have done that, don't know how. But don't assume you have fancy things like sqlite things in
ardino because even sqlite is very large to be implemented on AVR microcontroller. If android or RPI then you could
definitely use MYSQLite.

thanks lot....
in here for the port forwarding, do we need static ip?
lakindu93
Sergeant
Sergeant
Posts: 21
Joined: Wed Jun 26, 2013 12:45 pm
Location: Colombo

Re: Update Online Database using GSM/GPRS Shield

Post by lakindu93 » Sat Sep 20, 2014 8:18 pm

Neo wrote:While Semi has given lot of information on that, I would like to ask 'why not use a shared/Virtual or dedicated server for this?'. Server space had become cheaper over the years and you can buy a cheap shared hosting server for about Rs. 500 per month. If you get a domain registered and assigned to your server, then everything become easier to access.
still we use free hosting website like 1freewebhosting.com, when we frequently accessing that db, server side CPU exceed...
User avatar
SemiconductorCat
Major
Major
Posts: 455
Joined: Mon Aug 22, 2011 8:42 pm
Location: currently in hyperspace

Re: Update Online Database using GSM/GPRS Shield

Post by SemiconductorCat » Sun Sep 21, 2014 1:33 pm

You need port forwarding when you need to use your home router. For dynamic IPS.

Even the IP address is dynamic you could assign a static domain name over [ CNAME record ].
refer: http://en.wikipedia.org/wiki/CNAME_record
so then you could refer to ddns.org free dns name from your cname record.

But the thing is I don't know aridino DNS resolver is smart enough to do it.So simple way is just to
use ddns.org free domain name store in your chip. Not the public CNAME.

[ it's odd but I'm not sure aridino would support that or not.]
lakindu93
Sergeant
Sergeant
Posts: 21
Joined: Wed Jun 26, 2013 12:45 pm
Location: Colombo

Re: Update Online Database using GSM/GPRS Shield

Post by lakindu93 » Sun Sep 21, 2014 9:05 pm

SemiconductorCat wrote:You need port forwarding when you need to use your home router. For dynamic IPS.

Even the IP address is dynamic you could assign a static domain name over [ CNAME record ].
refer: http://en.wikipedia.org/wiki/CNAME_record
so then you could refer to ddns.org free dns name from your cname record.

But the thing is I don't know aridino DNS resolver is smart enough to do it.So simple way is just to
use ddns.org free domain name store in your chip. Not the public CNAME.

[ it's odd but I'm not sure aridino would support that or not.]
thanks... I will try....
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Update Online Database using GSM/GPRS Shield

Post by Neo » Mon Sep 22, 2014 9:07 am

You might like to try this method...
https://robot.lk/viewtopic.php?t=1547
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Update Online Database using GSM/GPRS Shield

Post by Neo » Mon Sep 22, 2014 9:12 am

I think I have forgotten to answer to the following question.
what is this <mids> and <dcss> ?
+CSCB Select Cell Broadcast Message Types
This command selects which types of cell broadcast messages are to be received.
(GSM 07.05)

Syntax:
AT+CSCB=[<mode>[,<mids>[, <dcss>]]]
Select message types. Default setting is 0,"",""

AT+CSCB?
Query current setting. Response is +CSCB: <mode>, <mids>, <dcss>

AT+CSCB=?
Show valid values. Response is +CSCB: (0,1).

Parameters:
<mode>:
0 message types specified in <mids> and <dcss> are accepted
1 message types specified in <mids> and <dcss> are not accepted

<mids>:
all different possible combinations of message identifiers, example:
"0,1,5,10-20,22"

<dcss>:
all different possible combinations of data coding schemes, example:
"0-3,5"
lakindu93
Sergeant
Sergeant
Posts: 21
Joined: Wed Jun 26, 2013 12:45 pm
Location: Colombo

Re: Update Online Database using GSM/GPRS Shield

Post by lakindu93 » Wed Sep 24, 2014 12:40 pm

Neo wrote:You might like to try this method...
https://robot.lk/viewtopic.php?t=1547
Neo wrote:I think I have forgotten to answer to the following question.
what is this <mids> and <dcss> ?
+CSCB Select Cell Broadcast Message Types
This command selects which types of cell broadcast messages are to be received.
(GSM 07.05)

Syntax:
AT+CSCB=[<mode>[,<mids>[, <dcss>]]]
Select message types. Default setting is 0,"",""

AT+CSCB?
Query current setting. Response is +CSCB: <mode>, <mids>, <dcss>

AT+CSCB=?
Show valid values. Response is +CSCB: (0,1).

Parameters:
<mode>:
0 message types specified in <mids> and <dcss> are accepted
1 message types specified in <mids> and <dcss> are not accepted

<mids>:
all different possible combinations of message identifiers, example:
"0,1,5,10-20,22"

<dcss>:
all different possible combinations of data coding schemes, example:
"0-3,5"
thanks lot for the info...
User avatar
ttyuodsy
Posts: 1
Joined: Wed Jun 24, 2015 7:21 am

Re: Update Online Database using GSM/GPRS Shield

Post by ttyuodsy » Wed Jun 24, 2015 7:51 am

It sounds really good, too wonderful!
Post Reply

Return to “Arduino”