🔴How to send sensor Data from Arduino UNO to MySQL Server(PHPMYADMIN) Offline (No internet)?
Ғылым және технология
#Arduino #MySQL#node_red_sql
@makersgroup
To send Arduino data to the database you don't need any wifi devices like eas8266, nodemcu, or Wifi shield LAN. You just follow the video and all is done quickly.
Node red installation guide:- • Node-RED Installation ...
The Arduino Code:-
int Humidity=0;
int Temprature=0;
int Light=0;
void setup() {
Serial.begin(9600);
Serial.println(F("DHTxx Unified Sensor Example"));
}
void loop() {
Temprature=random(20,40);
Humidity=random(80,120);
Light=random(100,160);
Serial.print("{\"Hum\":");
Serial.print(Humidity);
Serial.print(",\"Temp\":");
Serial.print(Temprature);
Serial.print(",\"Li\":");
Serial.print(Light);
Serial.println("}");
delay(2000);
}
The JSON code, to import the project:-
[
{
"id": "c73516050e9670c4",
"type": "tab",
"label": "Flow 2",
"disabled": false,
"info": "",
"env": []
},
{
"id": "8c0759f2b73c30ef",
"type": "serial in",
"z": "c73516050e9670c4",
"name": "",
"serial": "632ce51bae434d89",
"x": 150,
"y": 140,
"wires": [
[
"78c9b7023caae7d3"
]
]
},
{
"id": "78c9b7023caae7d3",
"type": "json",
"z": "c73516050e9670c4",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 250,
"y": 200,
"wires": [
[
"7fe478bfb80dde25"
]
]
},
{
"id": "7fe478bfb80dde25",
"type": "function",
"z": "c73516050e9670c4",
"name": "",
"func": "var value=JSON.parse(JSON.stringify(msg.payload));
value=msg;
var sensor1 = msg.payload.Li;
var sensor2 = msg.payload.Temp;
var sensor3 = msg.payload.Hum;
msg.payload = [sensor1, sensor2, sensor3];
msg.topic = 'INSERT INTO sensordata(Humidity, Temprature, Light) VALUES (?,?,?);';
return msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 360,
"y": 260,
"wires": [
[
"4aebfc352c4acb8b"
]
]
},
{
"id": "4aebfc352c4acb8b",
"type": "mysql",
"z": "c73516050e9670c4",
"mydb": "a8c399d7db9657e5",
"name": "",
"x": 510,
"y": 200,
"wires": [
[]
]
},
{
"id": "632ce51bae434d89",
"type": "serial-port",
"serialport": "COM4",
"serialbaud": "9600",
"databits": "8",
"parity": "none",
"stopbits": "1",
"waitfor": "",
"dtr": "none",
"rts": "none",
"cts": "none",
"dsr": "none",
"newline": "\
",
"bin": "false",
"out": "char",
"addchar": "",
"responsetimeout": "10000"
},
{
"id": "a8c399d7db9657e5",
"type": "MySQLdatabase",
"name": "",
"host": "127.0.0.1",
"port": "3306",
"db": "test",
"tz": "",
"charset": "UTF8"
}
]
Пікірлер: 70
Thank you so much, you helped me a lot on my project! 😇
@makersgroup
Жыл бұрын
Thank you for your comment
Hi, I have problem with database. In my project I use DHT11 and HW-038. In arduino ide I get data from my sensor correctly, but when I am trying to get data in my database, my sql returned empty result. Where can be my mistake?
thanks for the video sir, but i have a problem at the level of my node-red, when i open the work space and go manage palette to install serial or dashboard, it does not show any result instead it shows an error message that "no match found". please i wish someone really help me out.
i tested and it works with arduino mega 2560 too
@makersgroup
8 ай бұрын
Also it worked with arduino nano and mini too
Hello, we see the data as 0 in SQL even though we are doing the same thing you did. What do we write in SQL Insert Into values(?)? I would be glad if you can help me urgently.
@makersgroup
Жыл бұрын
Hello dear, first you need to make sure that the sensor data is sucessfully read by the arduino using your serial monitor, if you get the correct sensor reading on your arduino ide serial monitor, the error might be on your node red , you you have to amend the sensor data to send serially to the sql node as per your project
Hi sir I'm not getting serial.in in node red
Can you help us with our project? We used MQ135,MQ7 and DHT11 sensors. I connected the COM and the database but the values are not showing. My command prompt also shows "Unexpected string in JSON at position 26" What does it mean?
@lawrencepinlac5965
Жыл бұрын
I also tried your example, I used it as a guide but the values are not showing and the command prompt displaying "Unexpected string in JSON at position 26"
@makersgroup
Жыл бұрын
Does the example in the video works for you?, If you are able to make the project which is given on the video, changing the sensors and values is easy peasy. but if it does not work for you let me know so that I can assist you?
@lawrencepinlac5965
Жыл бұрын
@@makersgroup It worked, thanks for the help brother
@irving422
Жыл бұрын
@@lawrencepinlac5965 Bro, how did you make it work? I'm trying to read values from a LM35 but have the same problem as yours
Hello, may I know how the phpmyadmin is connected to mysql? and how would the arduino read information instead of writing to mysql?
@makersgroup
7 ай бұрын
You can follow this video kzread.info/dash/bejne/i6yfvJiIqry8ZJc.html to install xampp which consists of phpmyadmin and mysql
Hello Sir, how can i use the data from the database to give output in terms of LED indications?
@makersgroup
4 ай бұрын
If you do not need historical data you can directly amend in the arduino code so as to control the led in real time data from sensors
thanks for the
@makersgroup
3 ай бұрын
Make sure your internet connection is stable and follow up this tutorial m.kzread.info/dash/bejne/pYadrpKqgpyphZc.html if still did n't work reinstall the software and try again
Hello sir, can I still run this even if my arduino is not connected to my computer?
@makersgroup
Жыл бұрын
Since the arduino send the data serialy to the nodered software on your machine you are expected to connect your arduino with your machine
I am following you step by step its showing successfully deployed but no change in database why is it so
@makersgroup
8 ай бұрын
Make sure you have setup the database properly on both xampp and nodered softwares
Hi sir i have a problem when i am trying to upload it gives me the following result Sketch uses 2688 bytes (8%) of program storage space. Maximum is 32256 bytes. Global variables use 224 bytes (10%) of dynamic memory, leaving 1824 bytes for local variables. Maximum is 2048 bytes. avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xfe avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xfe avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xfe avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xfe avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xfe avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0xfe avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0xfe avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xfe avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xfe avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xfe Failed uploading: uploading error: exit status 1 i configure the board to Arduino uno and the port to COM4
@makersgroup
4 ай бұрын
make sure:- the Arduino port is COM4 in your case, by the way, the method also works for other boards in the same way. Also, reset, unplug the board and restart the arduino IDE and re-connect the board make sure the code you are trying to upload does not have an error
can i use the same approch to recieve data from database ?
@eljouska7171
Жыл бұрын
Could you please demonstrate the method i wanna recieve the data from the mysql db and send it to arduino is it possible ?
Hello sir, i got this problem : " serial port COM5 error: Error: Opening COM5: Access denied" can you help me?
@makersgroup
8 ай бұрын
This is because you do not close serial monitor or else there is other program which uses COM5
Can i do a request to database in base of id of a key fob that is scan on arduino and to look in database if it is there or not
@makersgroup
4 ай бұрын
Let me be honest with you , i haven't try this yet
@lumidemukaj7149
4 ай бұрын
@@makersgroup can u try?
I keep getting ER_BAD_DB_ERROR when deploying, any idea what the issue could be?
@makersgroup
6 ай бұрын
Incorrect database credentials: Double-check that you have provided the correct username, password, host, and database name when configuring the connection to the MySQL server. Database privileges: Ensure that the user you are connecting with has sufficient privileges to access and modify the specified database. The user should have at least the necessary permissions to insert data into the database. Database existence: Verify that the specified database actually exists on the MySQL server. If not, create the database manually or modify the configuration to use an existing database. Network or connectivity issues: Check if there are any network or firewall issues that are preventing the connection between your Node-RED application and the MySQL server. Ensure that the MySQL server is accessible from the machine running Node-RED. MySQL server configuration: Make sure that the MySQL server is properly configured to accept remote connections and that it allows connections from the machine running Node-RED.
i have problem. in serial monitor, it's appear correct humidity and temperature. in node-red, serial in and mysql is connected. but the problem is not save in to database. can you help me?
@makersgroup
9 ай бұрын
have you created humidity and temperature fields in the database so as to save the sent data values? kzread.info/dash/bejne/mIaCrdR-lNDUm8o.htmlsi=73M2FWxAtfCUzSnK
@user-cn8sq8td7y
9 ай бұрын
@@makersgroup yes, i follow every step by step. still not save to my database
Can this also work for Rfid RC522 inputs?
@makersgroup
5 ай бұрын
Yes but you must make it sutable for RFID
tn node, work like a restful server?
@makersgroup
2 ай бұрын
Nodes are a simplified widget purosly made to tackle specific task
I keep getting ER_BAD_FIELD_ERROR when deploying, any idea what the issue could be?
@makersgroup
5 ай бұрын
Do not copy any thing try to build from scratch to figure out the cause of the error easily
@makersgroup
5 ай бұрын
Do not copy any thing try to build from scratch to figure out the cause of the error easily
I have error that says "column "xxx" cannot be null"
@makersgroup
Жыл бұрын
This might happen because you have a variable with out a value, try to follow the tutorial step by step and if it works it will be easy to you to use for your own use with a litle bit of modification
Serial In node is not showing in node js then what can i do sir
@makersgroup
Жыл бұрын
You have to install serial node in your nodered
COM port is not connected in node-red . What can I do?
@makersgroup
10 ай бұрын
Thank you very much
@pramodpandit4890
10 ай бұрын
@@makersgroup you have solution for that error?
@makersgroup
10 ай бұрын
Yes you must change the COM port to the port which you used to upload the program and you must also close serial port since you could not acess serial port in 2 different software simultinously
Hello sir, I can't able to send the data to php database...
@nharish7425
Жыл бұрын
Both serial port and mysql port is connected..
@makersgroup
Жыл бұрын
I can assist you in person please contact me
there's no serial in in my node-red
@makersgroup
Жыл бұрын
You can install serial node in 20 seconds using the same procedure in this video, kzread.info/dash/bejne/pYadrpKqgpyphZc.html
How can I resolve the COM port conflict between arduino uno and node.js
@makersgroup
Жыл бұрын
First, close serial monitor if you opened it if that did n't fix the error you must check that you used the same port number to upload the program and on the nodered software
@user-zd2yi1fn3q
Жыл бұрын
@@makersgroup The instructions in your tutorial, are that, the "serial-in node" in node-red should use the same COM port as Arduino!
@user-zd2yi1fn3q
Жыл бұрын
@@makersgroup If I close either of the two apps, the running app works correctly, however my project requires running both apps simultaneously!
@makersgroup
Жыл бұрын
If you open serial port of arduino and node red serial node at the same time you will get error because as the name suggests serial communication can not be used simultinously for dual purpose
@user-zd2yi1fn3q
Жыл бұрын
@@makersgroup So, what options do I have, for my project to work?
one question, if i put my database online, that system will work correctly?
@makersgroup
Жыл бұрын
The Arduino board must be connected to the server inorder to send the data serialy via the connection cable
Does it work with esp8266?
@makersgroup
6 ай бұрын
You can use this video m.kzread.info/dash/bejne/f4x6qNGhYdLAmKg.html