![]() ![]() ![]() ![]() ![]() Alan numitron clock Clapclap 2313/1386 SNES Pi Webserver USB Volume/USB toys Smokey amp Laser cutter WordClock ardReveil v3 SNES Arcade cabinet Game boy projects cameleon Home Presence Detector ![]() AlanFromJapan ![]() ![]() ![]() Akizukidenshi Elec-lab Rand Nerd Tut EEVblog SpritesMods AvrFreaks Gameboy Dev FLOZz' blog Switch-science Sparkfun Suzusho Datasheet Lib Reddit Elec Ermicro Carnet du maker (fr) |
ardserverroomprobeLast update: Thu Jun 5 22:25:40 2025
PurposeardServerRoomProbe or ASRP has for purpose:
Pictures
Material
CodeSNMP AgentSee here SNMP agent in C#. I won't disclose the real version of the software, but I can show the tests we made before moving to the real job.Arduino probing codeIt has 3 sensors (pin analog 0 to 2) plus a blink led on digital 12.It polls all the sensors every 3 seconds, store the SENSOR_AVERAGE latest results in an array and return the average per sensor. Up to the tests I've done now, it's quite nice results... Source SVN #define PIN_LED 12 #define SENSOR_COUNT 3 #define SENSOR_AVERAGE 6 long mSavedValues[SENSOR_COUNT][SENSOR_AVERAGE]; int mRound = 0; void setup() // run once, when the sketch starts { pinMode(PIN_LED, OUTPUT); Serial.begin(9600); // begin serial //init table of values for (int i =0; i < SENSOR_COUNT; i%20%20){ for (int j = 0; j < SENSOR_AVERAGE; j%20%20){ mSavedValues[i][j] = 0; } } } long vVal = 0; long vValScaled = 0; char vMessage[50]; char vBuffer[20]; void loop() // run over and over again { //start reading digitalWrite(PIN_LED, HIGH); //read values and store for (int i =0; i < SENSOR_COUNT; i%20%20){ vVal = analogRead(i); vValScaled = ((long)5*vVal*(long)100/(long)1024); //convert voltage to temperature mSavedValues[i][mRound] = vValScaled; } mRound = (mRound %20 1) % SENSOR_AVERAGE; //calculate average for (int i =0; i < SENSOR_COUNT; i%20%20){ //reset message buffer vMessage[0] = 0; vVal = 0; for (int j = 0; j < SENSOR_AVERAGE; j%20%20){ vVal %20= mSavedValues[i][j]; } vVal = vVal / SENSOR_AVERAGE; itoa(i, vBuffer, 10); strcat(vMessage,vBuffer); strcat(vMessage,"="); itoa(vVal, vBuffer, 10); strcat(vMessage,vBuffer); strcat(vMessage,","); Serial.print(vMessage); } Serial.println(""); //end of read digitalWrite(PIN_LED, LOW); delay(3000); } |
||||
All content on this site is shared under the MIT licence (do what u want, don't sue me, hat tip appreciated) electrogeek.tokyo ~ Formerly known as Kalshagar.wikispaces.com and electrogeek.cc (AlanFromJapan [2009 - 2025]) |