Interface Arduino with RFID and MySQL (via PHP) #include <Ethernet.h>#define powerPin 10#define doorPin 11 byte mac[] = { 0x00, 0x00, 0x5E, 0x00, 0x01, 0xAA };byte ip[] = { 192, 168, 2, 9 };byte gateway[] = { 192, 168, 2, 254 };byte subnet[] = { 255, 255, 255, 0 };byte server[] = { 192, 168, 2, 148 }; Client client(server, 80); int DO_RESET_ETH_SHIELD = 8; // A delayed reset for a hardware issue boolean match = false; byte readCard[6]; // Stores an ID read from the RFID readerbyte checksum = 0; // Stores the checksum to verify the ID void setup() { pinMode(powerPin, OUTPUT); // Connected to Blue on tri-color LED to indicate reader is ready pinMode(doorPin, OUTPUT); // Connected to relay to activate the door lock Serial.begin(9600); // Connect to the serial port init_ethernet(); Ethernet.begin(mac, ip);} void loop () { byte val = 0; // Temp variable to hold the current byte // If the serial port is ready and we received the STX BYTE (2) then this function is called // to get the 4 BYTE ID + 1 BYTE checksum.
Sending temperature data from the arduino to a server. Hey, folks. Today i finished somewhat of a 0.8 version of my attempt to read temperature data from several DS18B20 temperature sensors with the arduino and to send them to my “kitchenserver”. Why kitchenserver? Because its running all night long and therefore had to go to kitchen. What is my goal? To read temperature data and store it in a database for further processing.
My father always says: “Die Sprache des Ingenieurs ist die Zeichnung” what means as much as ” the language of an engineer is drawings” so i made a little “graphic”: DS18B20—–>Patchpanel—–>(Arduino—>Ethernetshield)—->Network—–>(Server(Apache—->PHP—>MySQL) Edit: I found out that my first code is only working for one sensor, due to some Arduino->PHP inconsistencies (Arduino called the script for every temperature, but script wants to write all data in one call) So I rewrote the code to send all temperatures in one call. So here´s what i used: ethernet cable 12-port Patchpanel. Data logging with open source hardware and software in the energy sector.
Overview As power generation moves towards cleaner and smarter sources, small-scale photovoltaic panel arrays are springing up on roofs and in backyards.
Some of these installations are sophisticated with a high level of monitoring and self-adjustment; others have no self-awareness. In the latter case, it is still helpful for the owner to have a good and inexpensive source of basic operating data. You want to know if your panels are working optimally given the conditions. Both light and temperature, with the addition of wind speed and other factors, can influence panel output. The Arduino acts as an intermediary between the sensors and your data storage. Untitled. Untitled. Arduino sending requests to PHP script « Andy's Life. I’ve been asked by a number of people to provide an example of using the EtherShield library to pass data to a PHP script, to for example store sensor data in a database.
The example here is based on existing code that reads the SHT1x temperature and humidity sensor. The results are passed as parameters to a php script running on a local linux server. The php script then saves the results in a simple text file. The url format for this example is The example Arduino sketch can be downloaded here The PHP script used to test is < ? $timestamp = mktime(); //echo "Timestamp is ".date("d/m/Y H:i:s", $timestamp); $your_data = date("d/m/Y H:i:s", $timestamp) . "," . Echo "OK"; // Open the file for appending $fp = fopen("/var/www/data.txt", "a"); // Write the data to the file fwrite($fp, $your_data); // Close the file fclose($fp); ? This creates a file like this: Bookmark this post: