Inhalt/Arduino PM

aus Metalab Wiki, dem offenen Zentrum für meta-disziplinäre Magier und technisch-kreative Enthusiasten.
Zur Navigation springenZur Suche springen

Arduino Power Monitoring Project v1.2



Xml Impulses List Output:



Database:

  • Host: apm.in.nessus.at
  • User: apm
  • Pass: xxx
  • TABLES:
- impulses (contains all impulses data inserted)
- mapping (contains all mapped RACK_ID to PRIMARY_ID of table IMPULSES)
- rack_impulses (view containg merged information)


Django Web Frontend (temporary)




Hardware used/developed:

  • Arduino Duemilanove Atmel328 (Diecimila Atmel168)
  • Multiplexer Shields (8x Maxim-Intersil DG406)
  • Forlong DRS-201D kWh meter



Software used/developed:

scripts path @apm.in.nessus.at:/home/bons/apm

  • Arduino
 - Arduino_PM 1.2b (source code) revision B
 - Arduino_PM 1.3 (source code) version 3
             added sync feature between arduino memory and db
  • Python
 - apmrobot.py - Apm Robot for XML data import - (source code)
 - sync2db.py - Sync2db XML-arduino-memory and DB  - (source code)
 - memreset.py - Cronjob runs every monday and resets impulse memory of the arduino to prevent overrun
  • USAGE:
 - apmrobot.py - Parse XML output from ARDUINO and INSERT data in DB (sanity value check control included)
 - sync2db.py param1 param2 (where param1=RACK_ID and param2=KWfromDISPLAY to sync) 
         example: "sync2db.py N1P1 100" 
               this will update the DB value of RACK N1P1 with value 100*2000 (1kw/h = 2000 impulses)
               and reset the memory of the arduino for that rack to 0 to start counting

Project RoadMap:

  • Circuit:
    • Multiplexer Shield Circuit Design
    • Conversion with script metaboard.sh (process developed @ Metalab.at) to output file for CNC
    • Milling and Drilling with CNC
    • Soldering and Cabling


  • Software:
    • Arduino
      • Reading impulse on GPIO pins
      • Cycling Multiplexers
      • Store multiplexing and impulses data in "unsigned long" 3d matrix (2x16x8) [impulse capacity upgraded to 2^31-1]
      • Webserver with live XML output available on EthernetShield


    • Python
      • Manage data import from arduino memory xml (parse, check, insert)
      • Sync arduino memory with db to current read value (webserver http get parse for parameters)
      • Django DB model for data stored in memory
      • Django Views for showing stored Power Information

Power Racks/Switches Mapping

RackSwitch CableColor Connector/pin Mux Pin
N1P1 green A / 1 1 s1
N1P2 white A / 2 1 s2
N1P3 red A / 3 1 s3
N1P4 green A / 4 1 s4
N1P5 white A / 5 1 s5
N1P6 red A / 6 1 s6
N2P1 blue A / 7 1 s7
N2P2 red A / 8 1 s8
N2P3 blue B / 1 1 s9
N2P4 red B / 2 1 s10
N2P5 blue B / 3 1 s11
N2P6 white B / 4 1 s12
N3P1 green B / 5 1 s13
N3P2 green B / 6 1 s14
N3P3 white B / 7 1 s15
N3P4 red B / 8 1 s16
N3P5 green C / 1 2 s1
N3P6 red C / 2 2 s2
N4P1 blue C / 3 2 s3
N4P2 green C / 4 2 s4
N4P3 white C / 5 2 s5
N4P4 red C / 6 2 s6
N4P5 blue C / 7 2 s7
N4P6 white C / 8 2 s8
N5P1 white D / 1 2 s9
N5P2 green D / 2 2 s10
N5P3 blue D / 3 2 s11
N5P4 red D / 4 2 s12
N5P5 white D / 5 2 s13
N5P6 red D / 6 2 s14
N6P1 green D / 7 2 s15
N6P2 blue D / 8 2 s16
N6P3 blue E / 1 3 s1
N6P4 white E / 2 3 s2
N6P5 green E / 3 3 s3
N6P6 red E / 4 3 s4
N7P1 blue E / 5 3 s5
N7P2 white E / 6 3 s6
N7P3 red E / 7 3 s7
N7P4 green E / 8 3 s8
N7P5 white F / 1 3 s9
N7P6 green F / 2 3 s10
N8P1 blue F / 3 3 s11
N8P2 red F / 4 3 s12
N8P3 red F / 5 3 s13
N8P4 white F / 6 3 s14
N8P5 green F / 7 3 s15
N8P6 blue F / 8 3 s16
N9P1 blue G / 1 4 s1
N9P2 red G / 2 4 s2
N9P3 blue G / 3 4 s3
N9P4 green G / 4 4 s4
N9P5 green G / 5 4 s5
N9P6 white G / 6 4 s6
N10P1 red G / 7 4 s7
N10P2 white G / 8 4 s8
N10P3 blue H / 1 4 s9
N10P4 white H / 2 4 s10
N10P5 red H / 3 4 s11
N10P6 green H / 4 4 s12
N11P1 red H / 5 4 s13
N11P2 white H / 6 4 s14
N11P3 green H / 7 4 s15
N11P4 blue H / 8 4 s16
N11P5 green I / 1 5 s1
N11P6 white I / 2 5 s2
N12P1 blue I / 3 5 s3
N12P2 red I / 4 5 s4
N12P3 green I / 5 5 s5
N12P4 blue I / 6 5 s6
N12P5 white I / 7 5 s7
N12P6 red I / 8 5 s8
N13P1 red J / 1 5 s9
N13P2 blue J / 2 5 s10
N13P3 green J / 3 5 s11
N13P4 white J / 4 5 s12
N13P5 blue J / 5 5 s13
N13P6 white J / 6 5 s14
N14P1 green J / 7 5 s15
N14P2 red J / 8 5 s16
N14P3 n/a
N14P4 n/a
N14P5 n/a
N14P6 n/a


RackSwitch CableColor Connector/pin Mux Pin
U1P1 black/brown A / 1 1 s1
U1P2 white/gray A / 2 1 s2
U1P3 yellow/gray A / 3 1 s3
U1P4 red/white A / 4 1 s4
U1P5 white/black A / 5 1 s5
U1P6 pink/green A / 6 1 s6
U2P1 white/blue A / 7 1 s7
U2P2 brown/blue A / 8 1 s8
U2P3 brown B / 1 1 s9
U2P4 red B / 2 1 s10
U2P5 blue B / 3 1 s11
U2P6 gray B / 4 1 s12
U3P1 pink B / 5 1 s13
U3P2 green B / 6 1 s14
U3P3 white B / 7 1 s15
U3P4 yellow B / 8 1 s16
U3P5 green/blue C / 1 2 s1
U3P6 purple C / 2 2 s2
U4P1 red C / 3 2 s3
U4P2 black C / 4 2 s4
U4P3 white C / 5 2 s5
U4P4 yellow/blue C / 6 2 s6
U4P5 blue C / 7 2 s7
U4P6 brown C / 8 2 s8
U5P1 yellow/red D / 1 2 s9
U5P2 pink/red D / 2 2 s10
U5P3 green/red D / 3 2 s11
U5P4 gray/red D / 4 2 s12
U5P5 black D / 5 2 s13
U5P6 blue D / 6 2 s14
U6P1 white/yellow D / 7 2 s15
U6P2 yellow/brown D / 8 2 s16
U6P3 white/pink E / 1 3 s1
U6P4 white/blue E / 2 3 s2
U6P5 brown/blue E / 3 3 s3
U6P6 pink/green E / 4 3 s4
U7P1 yellow/pink E / 5 3 s5
U7P2 pink/brown E / 6 3 s6
U7P3 green/gray E / 7 3 s7
U7P4 yellow/gray E / 8 3 s8
U7P5 brown/black F / 1 3 s9
U7P6 white/red F / 2 3 s10
U8P1 white/black F / 3 3 s11
U8P2 red/blue F / 4 3 s12
U8P3 green/blue F / 5 3 s13
U8P4 gray/pink F / 6 3 s14
U8P5 yellow/blue F / 7 3 s15
U8P6 brown/brown F / 8 3 s16
U9P1 black G / 1 4 s1
U9P2 pink/gray G / 2 4 s2
U9P3 brown/green G / 3 4 s3
U9P4 white/green G / 4 4 s4
U9P5 yellow/brown G / 5 4 s5
U9P6 white/yellow G / 6 4 s6
U10P1 red/blue G / 7 4 s7
U10P2 purple G / 8 4 s8
U10P3 green/black H / 1 4 s9
U10P4 blue/black H / 2 4 s10
U10P5 yellow/black H / 3 4 s11
U10P6 white H / 4 4 s12
U11P1 gray/pink H / 5 4 s13
U11P2 red/black H / 6 4 s14
U11P3 gray/blue H / 7 4 s15
U11P4 pink/blue H / 8 4 s16
U11P5 gray/brown I / 1 5 s1
U11P6 gray/black I / 2 5 s2
U12P1 gray/blue I / 3 5 s3
U12P2 green/brown I / 4 5 s4
U12P3 yellow/red I / 5 5 s5
U12P4 pink/black I / 6 5 s6
U12P5 pink/red I / 7 5 s7
U12P6 pink/blue I / 8 5 s8
U13P1 brown/brown J / 1 5 s9
U13P2 white/red J / 2 5 s10
U13P3 gray/green J / 3 5 s11
U13P4 black/white J / 4 5 s12
U13P5 brown/blue J / 5 5 s13
U13P6 yellow/gray J / 6 5 s14
U14P1 white/blue J / 7 5 s15
U14P2 brown/black J / 8 5 s16
U14P3 n/a
U14P4 n/a
U14P5 n/a
U14P6 n/a