-
[Rpi server] Wifi USB dongle
07/10/2015 at 10:05 • 0 commentsWifi USB dongle configuration on rpi :
$sudo xemacs /etc/network/interfaces
auto lo iface lo inet loopback iface eth0 inet dhcp #allow-hotplug wlan0 #iface wlan0 inet manual #wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf #iface default inet dhcp auto wlan0 allow-hotplug wlan0 iface wlan0 inet static address 192.168.1.58 netmask 255.255.255.0 gateway 192.168.1.1 wpa-ssid "SSID" wpa-psk "PASSWORD"
Save file with Ctrl+x, Ctrl+s
Quit emacs: Ctrl+x, Ctrl-c
$sudo reboot
-
[Trinket sensing] Wires and first screen
06/17/2015 at 14:31 • 0 commentsTrinket sensing with everything working:
Sensors, Wifi and Screen test:
display.println("MODE_MAIN"); display.println(ipAddr); // ESP 01 - connected display.println(humiVal); // Temp & Humi Pro display.println(tempVal); // Temp & Humi Pro display.println(luxVal); // Digital light sensor display.println(moistureVal); // Soil moisture display.println(temperatureVal); // Barometer display.println(pressureVal); // Barometer display.println(atmVal); // Barometer display.println(altitudeVal); // Barometer
-
[Rpi server] First launch
06/16/2015 at 12:15 • 0 commentsI've installed the raspbian image on the sd card. https://www.raspberrypi.org/downloads/
With Apache 2, PHPMyAdmin, MySQL (http://elinux.org/RPi_Apache2, http://elinux.org/RPi_MySQL)
The database trinket_sensing now contains the temperature table:
In my case the RPI IP address is 192.168.1.58 (local address)
With the script below (insertTemp.php) I can add a value.
<?php $servername = "localhost"; $username = "root"; $password = "password"; $dbname = "trinket_sensing"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "INSERT INTO temperature (id, ts, value) VALUES (NULL, CURRENT_TIMESTAMP, '".$_GET['temp']."')"; if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $conn->error; } $conn->close(); ?>
I now have a working database test link. I will add all others later.
-
[Trinket sensing] ESP-01
06/16/2015 at 10:01 • 0 commentsBuy
$3 ESP-01 (ESP8266) module from Price Minister
Hardware
Vcc Trinket VBat pin Gnd Gnd CH_PD Trinket Pin 5 RESET Not connected GPIO_0 Not connected GPIO_2 Not Connected RX Trinket Tx pin TX Trinket Rx pin Arduino Code
#define WIFI_CH_PD 5 void setup(void) { digitalWrite(WIFI_CH_PD, LOW); delay(500); digitalWrite(WIFI_CH_PD, HIGH); delay(2000); Serial.begin(115200); } void loop(void) { Serial.println("AT"); //while (!Serial.available()) {} while (Serial.available()) { char c = Serial.read(); display.print(c); } display.println(""); delay(2000); }
-
[Trinket sensing] Grove barometer
06/08/2015 at 14:21 • 0 commentsNew Page
-
[Trinket sensing] Grove digital light sensor
06/08/2015 at 11:57 • 0 commentsNew Page
-
[Trinket sensing] Push-buttons (using interrupts)
06/08/2015 at 10:27 • 0 commentsHardware
PB1_SIG Trinket Pin 11 PB2_SIG Trinket Pin 12 Learn about arduino interrupts
http://playground.arduino.cc/Main/PinChangeInterrupt
Arduino Code
#define BUT_RIGHT 11 #define BUT_LEFT 12 void pciSetup(byte pin) { *digitalPinToPCMSK(pin) |= bit (digitalPinToPCMSKbit(pin)); // enable pin PCIFR |= bit (digitalPinToPCICRbit(pin)); // clear any outstanding interrupt PCICR |= bit (digitalPinToPCICRbit(pin)); // enable interrupt for the group } ISR (PCINT0_vect) // handle pin change interrupt for D8 to D13 here { /* if (digitalRead(BUT_RIGHT) == LOW || digitalRead(BUT_LEFT) == LOW) display.refresh();*/ } void setup(void) { pinMode(BUT_RIGHT, INPUT); pinMode(BUT_LEFT, INPUT); /* digitalWrite(BUT_RIGHT,HIGH); // set pullup - not required - hardware pullup digitalWrite(BUT_LEFT,HIGH); // set pullup - not required - hardware pullup */ pciSetup(BUT_RIGHT); pciSetup(BUT_LEFT); }
-
[Trinket sensing] SHARP Memory Display - 1.3" 96x96 Monochrome
06/08/2015 at 09:44 • 0 commentsBuy
https://www.adafruit.com/products/1393
Learn
https://learn.adafruit.com/adafruit-sharp-memory-display-breakout
(Link looks down today - http://www.downforeveryoneorjustme.com/learn.adafruit.com/adafruit-sharp-memory-display-breakout)
C++ Library
You need the Sharp and GFX libraries from Adafruit
https://github.com/adafruit/Adafruit_SHARP_Memory_Display
https://github.com/adafruit/Adafruit-GFX-Library
Hardware
Vin 3.3 V Gnd Gnd CLK Trinket Pin 9 DI Trinket Pin 10 CS Trinket Pin 4 Arduino code
#include <SPI.h> #include <Adafruit_GFX.h> #include <Adafruit_SharpMem.h> #define BLACK 0 #define WHITE 1 // any pins can be used #define SHARP_CLK 9 #define SHARP_DI 10 #define SHARP_CS 4 Adafruit_SharpMem display(SHARP_CLK, SHARP_DI, SHARP_CS); void setup(void) { } void loop(void) { display.clearDisplay(); display.setTextSize(1); display.setTextColor(BLACK); display.setCursor(0,0); display.setTextColor(WHITE, BLACK); display.print("It works !"); }
-
[Trinket sensing] Grove temperature and humidity sensor pro
06/05/2015 at 07:36 • 0 commentsBuy
http://www.seeedstudio.com/depot/grove-temperaturehumidity-sensor-pro-p-838.html
Wiki
http://www.seeedstudio.com/wiki/Grove_-_Temperature_and_Humidity_Sensor_Pro
C++ Library
https://github.com/Seeed-Studio/Grove_Temperature_And_Humidity_Sensor
Hardware
Vcc 3.3 V Gnd Gnd Sig Trinket A0 (Analog 0) Arduino code
#include "DHT.h" #define DHTPIN A0 #define DHTTYPE DHT22 DHT tempAndHumi(DHTPIN, DHTTYPE); void loop(void) { } void setup(void) { float humiVal = tempAndHumi.readHumidity(); float tempVal = tempAndHumi.readTemperature(); }
-
[Trinket sensing] Grove moisture sensor
06/05/2015 at 07:31 • 0 commentsBuy
http://www.seeedstudio.com/depot/Grove-Moisture-Sensor-p-955.html
Wiki
http://www.seeedstudio.com/wiki/Grove_-_Moisture_Sensor
Hardware
Vcc 3.3 V Gnd Gnd Sig Trinket A1 (Analog 1) Arduino code
#define PIN_MOISTURE A1 void setup(void) { pinMode(PIN_MOISTURE, INPUT); } void loop(void) { int moistureVal = analogRead(PIN_MOISTURE); }