Capacitive FOG sensor to Thingspeak
From emboxit
TODO: Add relaxation oscillator schematic
Contents
[hide]System setup
Relaxation oscillator frequency
Frequency to thingSpeak
400px400px400px400px400px400px
3 water levels
Details of capacitive probe
mbed code
<cpp>
- include "mbed.h"
- include "rtos.h"
- include "ThingSpeak.h"
- include "EthernetInternet.h"
- include "FrequencySensor.h"
InternetInterface* internet;
ThingSpeak thingspeak( "7JG4EJ1Y7KUEAR09" ); // Replace with correct ThingSpeak Write API Key
FrequencySensor freq_sensor( p30, &thingspeak, 1 ); // Pin must be p29 or p30. Third parameter is ThingSpeak field number
void ReadSensorsIntoQueueThread(void const *){
while(1){ freq_sensor.ReadIntoQueue(); Thread::wait(1000); }
}
void ThingSpeakUploadThread(void const *){
Thread::wait(15000); while(1){ thingspeak.UploadQueuedReadings(); Thread::wait(30000); }
}
int main(){
internet = new EthernetInternet; internet->Connect(); Thread t1( ReadSensorsIntoQueueThread ); Thread t2( ThingSpeakUploadThread ); while(1);
} </cpp>