Update Online Database using GSM/GPRS Shield

Microcontroller, DSP and FPGA Topics

Re: Update Online Database using GSM/GPRS Shield

Postby lakindu93 » Sat Sep 20, 2014 2:43 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?
User avatar
lakindu93
 
Posts: 21
Joined: Wed Jun 26, 2013 7:15 am
Cash on hand: 716.20
Location: Colombo

Invitations sent: 0
Registered friends: 0
Reputation point: 0
Lance Corporal

Re: Update Online Database using GSM/GPRS Shield

Postby lakindu93 » Sat Sep 20, 2014 2:48 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
lakindu93
 
Posts: 21
Joined: Wed Jun 26, 2013 7:15 am
Cash on hand: 716.20
Location: Colombo

Invitations sent: 0
Registered friends: 0
Reputation point: 0
Lance Corporal

Re: Update Online Database using GSM/GPRS Shield

Postby SemiconductorCat » Sun Sep 21, 2014 8:03 am

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.]
User avatar
SemiconductorCat
 
Posts: 462
Joined: Mon Aug 22, 2011 3:12 pm
Cash on hand: 23,861.30
Location: currently in hyperspace

Invitations sent: 0
Registered friends: 0
Reputation point: 9
Corporal

Re: Update Online Database using GSM/GPRS Shield

Postby lakindu93 » Sun Sep 21, 2014 3:35 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
lakindu93
 
Posts: 21
Joined: Wed Jun 26, 2013 7:15 am
Cash on hand: 716.20
Location: Colombo

Invitations sent: 0
Registered friends: 0
Reputation point: 0
Lance Corporal

Re: Update Online Database using GSM/GPRS Shield

Postby Neo » Mon Sep 22, 2014 3:37 am

You might like to try this method...
viewtopic.php?t=1547
User avatar
Neo
Site Admin
Site Admin
 
Posts: 2612
Joined: Tue Jul 14, 2009 8:37 pm
Cash on hand: 221,202.10
Bank: 15,536,454.00
Location: Colombo/London
Medals: 2
EC_Bronze_Star (1) EC_Achievment (1)

Invitations sent: 94
Registered friends: 12
Highscores: 13
Reputation point: 74
Lieutenant

Re: Update Online Database using GSM/GPRS Shield

Postby Neo » Mon Sep 22, 2014 3:42 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"
User avatar
Neo
Site Admin
Site Admin
 
Posts: 2612
Joined: Tue Jul 14, 2009 8:37 pm
Cash on hand: 221,202.10
Bank: 15,536,454.00
Location: Colombo/London
Medals: 2
EC_Bronze_Star (1) EC_Achievment (1)

Invitations sent: 94
Registered friends: 12
Highscores: 13
Reputation point: 74
Lieutenant

Re: Update Online Database using GSM/GPRS Shield

Postby lakindu93 » Wed Sep 24, 2014 7:10 am

Neo wrote:You might like to try this method...
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
lakindu93
 
Posts: 21
Joined: Wed Jun 26, 2013 7:15 am
Cash on hand: 716.20
Location: Colombo

Invitations sent: 0
Registered friends: 0
Reputation point: 0
Lance Corporal

Re: Update Online Database using GSM/GPRS Shield

Postby ttyuodsy » Wed Jun 24, 2015 2:21 am

It sounds really good, too wonderful!
User avatar
ttyuodsy
 
Posts: 1
Joined: Wed Jun 24, 2015 1:51 am
Cash on hand: 130.60

Invitations sent: 0
Registered friends: 0
Reputation point: 0
Lance Corporal

Previous

Return to Embedded Processors & Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron