RPi Locator and Display Services
|
Go to the source code of this file.
Macros | |
#define | A2D_BASE 120 |
#define | LED 120 |
#define | A2D_THERM A2D_BASE + 2 |
#define | A2D_PHOTO A2D_BASE + 3 |
#define | THERMISTORNOMINAL 10000 |
#define | TEMPERATURENOMINAL 25 |
#define | BCOEFFICIENT 4207.0 |
#define | SERIESRESISTOR 10240 |
#define | A2D_PERCISION 255.0 |
#define | MAXREADS 5 |
#define | sA 1.129148E-03 |
#define | sB 2.34125E-04 |
#define | sC 8.76741E-08 |
#define | calibrationOffset -0.5 |
Functions | |
double | adcToOhms (int rawADC) |
double | steinhartAdcToCelsius (int rawADC) |
double | betaAdcToCelsius (int rawADC) |
double | readAverageSensorValue (int sensor) |
int | sknGetModuleTemp (char *buffer) |
int | sknGetModuleBright (char *buffer) |
int | main (int argc, char *argv[]) |
#define A2D_BASE 120 |
which is based on the I2C controller PCF8591T to access:
Definition at line 17 of file a2d_display_client.c.
Referenced by main().
#define A2D_PERCISION 255.0 |
Definition at line 34 of file a2d_display_client.c.
Referenced by adcToOhms().
#define A2D_PHOTO A2D_BASE + 3 |
Definition at line 20 of file a2d_display_client.c.
Referenced by sknGetModuleBright().
#define A2D_THERM A2D_BASE + 2 |
Definition at line 19 of file a2d_display_client.c.
Referenced by sknGetModuleTemp().
#define BCOEFFICIENT 4207.0 |
Definition at line 30 of file a2d_display_client.c.
Referenced by betaAdcToCelsius().
#define calibrationOffset -0.5 |
Definition at line 43 of file a2d_display_client.c.
Referenced by betaAdcToCelsius(), and steinhartAdcToCelsius().
#define LED 120 |
Definition at line 18 of file a2d_display_client.c.
Referenced by main().
#define MAXREADS 5 |
Definition at line 36 of file a2d_display_client.c.
Referenced by readAverageSensorValue().
#define sA 1.129148E-03 |
Definition at line 40 of file a2d_display_client.c.
Referenced by steinhartAdcToCelsius().
#define sB 2.34125E-04 |
Definition at line 41 of file a2d_display_client.c.
Referenced by steinhartAdcToCelsius().
#define sC 8.76741E-08 |
Definition at line 42 of file a2d_display_client.c.
Referenced by steinhartAdcToCelsius().
#define SERIESRESISTOR 10240 |
Definition at line 32 of file a2d_display_client.c.
Referenced by adcToOhms().
#define TEMPERATURENOMINAL 25 |
Definition at line 28 of file a2d_display_client.c.
Referenced by betaAdcToCelsius().
#define THERMISTORNOMINAL 10000 |
Definition at line 26 of file a2d_display_client.c.
Referenced by betaAdcToCelsius().
double adcToOhms | ( | int | rawADC | ) |
Convert rawADC into Ohms
Definition at line 48 of file a2d_display_client.c.
References A2D_PERCISION, and SERIESRESISTOR.
Referenced by betaAdcToCelsius(), and steinhartAdcToCelsius().
double betaAdcToCelsius | ( | int | rawADC | ) |
Inputs ADC Value from Thermistor and outputs Temperature in Celsius
Utilizes the Beta Factor Equation: 1/T = 1/To + 1/B * ln(R/Ro) I'm concerned about R1, in resistance, which is really 1K not 10K https://learn.adafruit.com/thermistor/using-a-thermistor
Definition at line 87 of file a2d_display_client.c.
References adcToOhms(), BCOEFFICIENT, calibrationOffset, TEMPERATURENOMINAL, and THERMISTORNOMINAL.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 170 of file a2d_display_client.c.
References A2D_BASE, gd_i_i2c_address, gd_i_socket, gd_i_update, gd_pch_message, gd_pch_service_name, gi_exit_flag, _serviceEntry::ip, LED, _serviceEntry::name, _serviceEntry::port, _serviceRequest::request, SD_DEBUG, SD_NOTICE, SD_WARNING, service_registry_destroy(), service_registry_entry_count(), service_registry_find_entry(), service_registry_get_via_udp_broadcast(), signals_cleanup(), signals_init(), skn_handle_locator_command_line(), skn_program_name_and_description_set(), SKN_RUN_MODE_RUN, skn_service_request_create(), skn_udp_host_create_broadcast_socket(), skn_udp_host_create_regular_socket(), skn_udp_service_request(), sknGetModuleBright(), sknGetModuleTemp(), SZ_CHAR_BUFF, and SZ_INFO_BUFF.
double readAverageSensorValue | ( | int | sensor | ) |
Averages sensor value from five reads
Definition at line 104 of file a2d_display_client.c.
References MAXREADS.
Referenced by sknGetModuleBright(), and sknGetModuleTemp().
int sknGetModuleBright | ( | char * | buffer | ) |
Photo Resistor Brightness Indicator
Definition at line 141 of file a2d_display_client.c.
References A2D_PHOTO, readAverageSensorValue(), and SZ_INFO_BUFF.
Referenced by main().
int sknGetModuleTemp | ( | char * | buffer | ) |
Free Air Temps
Definition at line 121 of file a2d_display_client.c.
References A2D_THERM, readAverageSensorValue(), steinhartAdcToCelsius(), and SZ_INFO_BUFF.
Referenced by main().
double steinhartAdcToCelsius | ( | int | rawADC | ) |
Inputs ADC Value from Thermistor and outputs Temperature in Celsius
Utilizes the Steinhart-Hart Thermistor Equation:
If r is the thermistor resistance we can use the Steinhart-Hart equation to calculate the temperature t in degrees kelvin: return Celsius t = 1 / (sA + sB * ln(r) + sC * ln(r) * ln(r) * ln(r))
Temperature in Kelvin = 1 / (A + B * ln(r) + C * ln(r) * ln(r) * ln(r)) where A = 0.001129148, B = 0.000234125 and C = 8.76741E-08
Definition at line 69 of file a2d_display_client.c.
References adcToOhms(), calibrationOffset, sA, sB, and sC.
Referenced by sknGetModuleTemp().