Rajbir Singh
Published © LGPL

Node-RED to MySQL

Sending-data-of-IoT-Wireless-Temperature-and-Humidity-Sensor-to-MySQL.

IntermediateProtip3 hours4,981
Node-RED to MySQL

Things used in this project

Hardware components

National Control Devices IoT Long Range Wireless Temperature Humidity Sensor
×1
National Control Devices 900HP-S3B Long Range Wireless Mesh Modem with USB Interface
×1

Software apps and online services

Node-red
XAMPP

Story

Read more

Code

node_red_flow_MySQL

JSON
[{"id":"b22282c7.8a1ff","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"3229a6b4.fc3aaa","type":"ncd-gateway-node","z":"b22282c7.8a1ff","name":"","connection":"d75ef2c7.91d15","x":130,"y":80,"wires":[["7287d07d.873e2"]]},{"id":"7287d07d.873e2","type":"debug","z":"b22282c7.8a1ff","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":390,"y":80,"wires":[]},{"id":"6c4ef497.1b6d2c","type":"ncd-wireless-node","z":"b22282c7.8a1ff","name":"","connection":"21eeb9e.1198d46","config_comm":"558ba70.b076958","addr":"","sensor_type":"1","auto_config":"","node_id":0,"delay":300,"destination":"0000FFFF","power":4,"retries":10,"pan_id":"7FFF","change_enabled":"","change_pr":"0","change_interval":"0","cm_calibration":"60.6","bp_altitude":"0","bp_pressure":"0","bp_temp_prec":"0","bp_press_prec":"0","amgt_accel":"0","amgt_mag":"0","amgt_gyro":"0","impact_accel":"0","impact_data_rate":"4","impact_threshold":25,"impact_duration":1,"activ_interr_x":1,"activ_interr_y":2,"activ_interr_z":4,"activ_interr_op":8,"filtering":0,"data_rate":5,"time_series":0,"reading_type":1,"x":120,"y":200,"wires":[["8c23823b.fd8dd","27b7a925.9852c6"]]},{"id":"8c23823b.fd8dd","type":"debug","z":"b22282c7.8a1ff","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":350,"y":320,"wires":[]},{"id":"27b7a925.9852c6","type":"function","z":"b22282c7.8a1ff","name":"MySQL Function","func":"temperature = msg.payload.temperature\nhumidity = msg.payload.humidity\nmsg.topic = \"INSERT INTO sensor_data ( `temperature`, `humidity`) VALUES ( \"+ temperature+\", \"+ humidity +\");\"\nreturn msg;\n\n","outputs":1,"noerr":0,"x":450,"y":200,"wires":[["2183444d.b1114c"]]},{"id":"2183444d.b1114c","type":"mysql","z":"b22282c7.8a1ff","mydb":"4bd6fc82.510b44","name":"MySQLDatabase","x":730,"y":200,"wires":[[]]},{"id":"d75ef2c7.91d15","type":"ncd-gateway-config","z":"","name":"","comm_type":"serial","ip_address":"","tcp_port":"2101","port":"COM6","baudRate":"115200","pan_id":"7fff","rssi":false},{"id":"21eeb9e.1198d46","type":"ncd-gateway-config","z":"","name":"","comm_type":"serial","ip_address":"","tcp_port":"2101","port":"COM6","baudRate":"115200","pan_id":"7fff","rssi":false},{"id":"558ba70.b076958","type":"ncd-gateway-config","z":"","name":"","comm_type":"serial","ip_address":"","tcp_port":"2101","port":"COM6","baudRate":"115200","pan_id":"7fff","rssi":false},{"id":"4bd6fc82.510b44","type":"MySQLdatabase","z":"","host":"127.0.0.1","port":"3306","db":"rjdatabase","tz":"GMT +5:30"}]

Credits

Rajbir Singh

Rajbir Singh

19 projects • 4 followers
A skilled developer with experience of extensive development in the Internet of Things (IoT).

Comments