--- /dev/null
+SUBDIRS = src doc
--- /dev/null
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.69])
+AC_INIT([sensors], [0.1], [arjen@andromeda.nl])
+AM_INIT_AUTOMAKE([-Wall foreign])
+AC_CONFIG_SRCDIR([src/Cmeter.cpp])
+AC_CONFIG_HEADERS([config.h])
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_CC
+
+# Check for wx-widgets
+
+AC_PATH_PROG(WX_CONFIG, wx-config, no)
+if test $WX_CONFIG = "no"
+then
+ echo "WX widgets is not installed"
+ exit 1
+fi
+
+WX_CXXFLAGS=`wx-config --cxxflags`
+CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS"
+WX_LDFLAGS=`wx-config --libs`
+LDFLAGS="$LDFLAGS $WX_LDFLAGS"
+
+#Checks for libraries.
+AC_CHECK_LIB([pigpiod_if2], [pigpio_start])
+# FIXME: Replace `main' with a function in `-lrt':
+AC_CHECK_LIB([rt], [main])
+
+# Checks for header files.
+AC_CHECK_HEADERS([unistd.h])
+AC_CHECK_HEADERS([wx/wx.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_CHECK_HEADER_STDBOOL
+AC_TYPE_UINT32_T
+
+# Checks for library functions.
+
+AC_CONFIG_FILES([Makefile
+ src/Makefile])
+AC_OUTPUT
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="180mm"
+ height="120mm"
+ viewBox="0 0 180 120"
+ version="1.1"
+ id="svg8"
+ inkscape:version="0.92.1 r15371"
+ sodipodi:docname="C-meter.svg">
+ <defs
+ id="defs2">
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lend"
+ style="overflow:visible;"
+ inkscape:isstock="true">
+ <path
+ id="path4518"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.979899"
+ inkscape:cx="296.1653"
+ inkscape:cy="233.64947"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1920"
+ inkscape:window-height="1136"
+ inkscape:window-x="1920"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-177)">
+ <circle
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path4485"
+ cx="43.965836"
+ cy="210.27103"
+ r="5.4790254" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 38.55363,210.00377 10.824414,0.13363"
+ id="path4487"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4489"
+ width="12.027128"
+ height="1.4699824"
+ x="12.962574"
+ y="236.46344" />
+ <rect
+ y="240.60612"
+ x="12.962574"
+ height="1.4699824"
+ width="12.027128"
+ id="rect4491"
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.80057627;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4493"
+ width="18.859158"
+ height="2.4033513"
+ x="34.536259"
+ y="263.1246" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 43.965837,190.49309 v 14.16529"
+ id="path4495"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.23094726px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 43.965837,216.01733 v 14.96709"
+ id="path4497"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.22726534px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 43.965837,246.88696 v 16.16981"
+ id="path4499"
+ inkscape:connector-curvature="0" />
+ <circle
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path4501"
+ cx="43.965836"
+ cy="189.08994"
+ r="1.2695302" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4503"
+ width="0.8018086"
+ height="4.1426778"
+ x="73.565933"
+ y="231.6526" />
+ <rect
+ y="238.46797"
+ x="73.565933"
+ height="4.1426778"
+ width="0.8018086"
+ id="rect4505"
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4507"
+ width="0.8018086"
+ height="4.1426778"
+ x="73.565933"
+ y="245.28334" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 73.705357,233.59449 h -5.197174 l 0.09449,-11.62276 H 43.845239"
+ id="path4509"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 73.327381,247.39062 h -5.480656 v 7.65402 H 43.845239"
+ id="path4511"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.265;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Lend)"
+ d="m 67.846725,247.39062 v -6.70907 h 5.480656"
+ id="path4513"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 77.296131,232.08259 v 16.91443 h 8.88244 v 26.17485"
+ id="path4797"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 119.2022,214.68099 v 28.0633 l 29.65347,-14.47247 z"
+ id="path4799"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 121.07309,221.89726 c 4.94449,0 4.81085,0 4.81085,0"
+ id="path4801"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 121.20673,233.92439 h 4.40994"
+ id="path4803"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 123.61215,219.62547 v 4.54358"
+ id="path4805"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 68.602671,221.97173 H 119.20221"
+ id="path4807"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4809"
+ width="4.9444861"
+ height="14.833458"
+ x="156.88721"
+ y="200.5157" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 148.85567,228.27182 H 159.159 v -12.78903"
+ id="path4811"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 159.42627,189.55765 V 200.5157"
+ id="path4813"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 159.159,228.27182 v 48.14842"
+ id="path4815"
+ inkscape:connector-curvature="0" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="90.337105"
+ y="280.29565"
+ id="text4821"><tspan
+ sodipodi:role="line"
+ id="tspan4819"
+ x="90.337105"
+ y="280.29565"
+ style="stroke-width:0.26458332px">Cycle</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="102.6315"
+ y="239.26978"
+ id="text4825"><tspan
+ sodipodi:role="line"
+ id="tspan4823"
+ x="102.6315"
+ y="239.26978"
+ style="stroke-width:0.26458332px">Uref</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="161.69806"
+ y="281.89926"
+ id="text4829"><tspan
+ sodipodi:role="line"
+ id="tspan4827"
+ x="161.69806"
+ y="281.89926"
+ style="stroke-width:0.26458332px">Out</tspan></text>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 119.06857,236.73072 H 104.50238"
+ id="path4522"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 19.109771,236.59709 V 231.2517 H 39.55589"
+ id="path4524"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 19.64431,241.54157 v 5.21176 h 20.045214"
+ id="path4526"
+ inkscape:connector-curvature="0" />
+ <circle
+ r="1.2695302"
+ cy="231.85306"
+ cx="43.832199"
+ id="circle4528"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <circle
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="circle4530"
+ cx="43.832199"
+ cy="231.85306"
+ r="1.2695302" />
+ <circle
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="circle4532"
+ cx="43.965836"
+ cy="245.48381"
+ r="1.2695302" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="31.003265"
+ y="240.47249"
+ id="text4536"><tspan
+ sodipodi:role="line"
+ id="tspan4534"
+ x="31.003265"
+ y="240.47249"
+ style="stroke-width:0.26458332px">C1</tspan></text>
+ </g>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="120mm"
+ height="180mm"
+ viewBox="0 0 120 180"
+ version="1.1"
+ id="svg8"
+ inkscape:version="0.92.1 r15371"
+ sodipodi:docname="input-divider.svg">
+ <defs
+ id="defs2">
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="marker4933"
+ style="overflow:visible;"
+ inkscape:isstock="true">
+ <path
+ id="path4931"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4515"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+ transform="scale(0.8) translate(12.5,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow1Lend"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4518"
+ d="M 0,0 5,-5 -12.5,0 5,5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="matrix(-0.8,0,0,-0.8,-10,0)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.979899"
+ inkscape:cx="116.88335"
+ inkscape:cy="437.76962"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1920"
+ inkscape:window-height="1163"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-117)">
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.80000001;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4526"
+ width="7.7508163"
+ height="21.381561"
+ x="35.546848"
+ y="144.3891" />
+ <rect
+ y="197.0412"
+ x="35.546848"
+ height="21.381561"
+ width="7.7508163"
+ id="rect4528"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.80000001;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.80000001;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4530"
+ width="7.7508163"
+ height="21.381561"
+ x="66.55011"
+ y="144.3891" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 14.967093,131.29289 H 39.288619 V 144.3891"
+ id="path4551"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.29518309px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 39.823159,165.77066 V 197.0412"
+ id="path4553"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4555"
+ d="m 39.422255,218.42276 v 21.91611"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.24711864px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.80000001;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4557"
+ width="17.372519"
+ height="1.6036172"
+ x="30.735994"
+ y="240.20523" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 39.689524,183.94499 H 95.147952"
+ id="path4559"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 70.826423,131.6938 v 12.6953"
+ id="path4561"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 70.559154,165.9043 v 18.04069"
+ id="path4563"
+ inkscape:connector-curvature="0" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="32.205978"
+ y="157.0844"
+ id="text4567"><tspan
+ sodipodi:role="line"
+ id="tspan4565"
+ x="32.205978"
+ y="157.0844"
+ style="stroke-width:0.26458332px">R1</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="33.141422"
+ y="210.40466"
+ id="text4571"><tspan
+ sodipodi:role="line"
+ id="tspan4569"
+ x="33.141422"
+ y="210.40466"
+ style="stroke-width:0.26458332px">R2</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="80.581764"
+ y="156.54987"
+ id="text4575"><tspan
+ sodipodi:role="line"
+ id="tspan4573"
+ x="80.581764"
+ y="156.54987"
+ style="stroke-width:0.26458332px">R3</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="98.355179"
+ y="181.27229"
+ id="text4579"><tspan
+ sodipodi:role="line"
+ id="tspan4577"
+ x="98.355179"
+ y="181.27229"
+ style="stroke-width:0.26458332px">Uo</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="17.63979"
+ y="129.0211"
+ id="text4583"><tspan
+ sodipodi:role="line"
+ id="tspan4581"
+ x="17.63979"
+ y="129.0211"
+ style="stroke-width:0.26458332px">Uin</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="73.499123"
+ y="128.62021"
+ id="text4587"><tspan
+ sodipodi:role="line"
+ id="tspan4585"
+ x="73.499123"
+ y="128.62021"
+ style="stroke-width:0.26458332px">Uc</tspan></text>
+ </g>
+</svg>
--- /dev/null
+<?xml version='1.0'?>
+<doc>
+<article>
+
+<titlepage>
+ <title>Raspberry Pi Sensors</title>
+ <author>Arjen Baart <arjen@andromeda.nl></author>
+ <date>February 18, 2021</date>
+ <abstract>
+ </abstract>
+</titlepage>
+
+<chapter>
+ <heading>Single slope voltmeter</heading>
+
+<para>
+The single slope voltmeter creates a ramp by charginf a capacitor with a contant current.
+See also <emph>The Art of Electronics, page 416</emph>.
+The figure below shows the concept:
+</para>
+
+<picture src='single-slope.svg'/>
+
+<para>
+At rest, the capacitor C1 is shorted to ground by applying a positive voltage to the gate of the MOSFET.
+The cycle starts when the gate voltage drops to 0 and capacitor C1 charges from the current source.
+The voltage rises linearly and is compared to the input voltage.
+When the voltage across C1 rises above the input voltage connected to the negative input of the comparator,
+the comparator's open collector output is drawn to ground.
+The cycle is shown in the timing diagram below:
+</para>
+
+<picture src='timing-diagram.svg'/>
+
+<para>
+The time from releasing the MOSFET to the comparator's output going low is proportianal to the input volatge:
+
+<verbatim>
+ t = C / I * Uin
+</verbatim>
+</para>
+
+<para>
+The measurable range of the input voltage is determined by the input voltage that can be handled by the comparator
+and the maximum voltage for the current source.
+For most comparators, the input voltage must be within 0.5 V to 1 V of the supply rails.
+With a supply voltage of 5V, input voltages from 1 to 4V can be measured.
+To measure input voltages from 0 to 30 V, an input devider must devide the input voltage by 10 and provide
+an offset of 1 V:
+</para>
+
+<picture src='input-divider.svg'/>
+
+<para>
+<!--
+<math xmlns="http://www.w3.org/1998/Math/MathML">
+<mfrac>
+ <mi>U</mi>
+ <mi>R</mi>
+</mfrac>
+</math>
+-->
+
+<!--
+ <math:mrow>
+ <math:mi>U<math:msub>in</math:msub></math:mi>
+ </math:mrow>
+ <math:mrow>
+ <math:mi>R<math:msub>1</math:msub></math:mi>
+ </math:mrow>
+-->
+
+<verbatim>
+ (Uin - Uo) / R1 + (Uc - Uo) / R3 - Uo / R2 = 0
+</verbatim>
+<verbatim>
+ Uo = (Uin * R2 * R3 + Uc * R1 * R2) / (R2 * R3 + R1 * R2 + R1 * R3)
+
+ Uc = 5 V
+ R1 = 1.2 M
+ R2 = 150k
+ R3 = 560 k
+
+ Uo = Uin * 0.086 + 0.97
+</verbatim>
+</para>
+</chapter>
+<chapter>
+ <heading>Capacitance meter</heading>
+<para>
+When, instead of measuring Uin, the input voltage is fixed to Uref, the same
+circuit can be used to measure the capacitance of C1, as shown below:
+</para>
+<picture src='C-meter.svg'/>
+</chapter>
+</article>
+</doc>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="180mm"
+ height="120mm"
+ viewBox="0 0 180 120"
+ version="1.1"
+ id="svg8"
+ inkscape:version="0.92.1 r15371"
+ sodipodi:docname="single-slope.svg">
+ <defs
+ id="defs2">
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lend"
+ style="overflow:visible;"
+ inkscape:isstock="true">
+ <path
+ id="path4518"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.979899"
+ inkscape:cx="397.18055"
+ inkscape:cy="235.66978"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1920"
+ inkscape:window-height="1163"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-177)">
+ <circle
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path4485"
+ cx="43.965836"
+ cy="210.27103"
+ r="5.4790254" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 38.55363,210.00377 10.824414,0.13363"
+ id="path4487"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4489"
+ width="12.027128"
+ height="1.4699824"
+ x="37.952274"
+ y="235.66164" />
+ <rect
+ y="239.80432"
+ x="37.952274"
+ height="1.4699824"
+ width="12.027128"
+ id="rect4491"
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.80057627;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4493"
+ width="18.859158"
+ height="2.4033513"
+ x="34.536259"
+ y="263.1246" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 43.965837,190.49309 v 14.16529"
+ id="path4495"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 43.965837,216.01733 v 19.64431"
+ id="path4497"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 43.965837,241.14067 v 21.9161"
+ id="path4499"
+ inkscape:connector-curvature="0" />
+ <circle
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path4501"
+ cx="43.965836"
+ cy="189.08994"
+ r="1.2695302" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4503"
+ width="0.8018086"
+ height="4.1426778"
+ x="73.565933"
+ y="231.6526" />
+ <rect
+ y="238.46797"
+ x="73.565933"
+ height="4.1426778"
+ width="0.8018086"
+ id="rect4505"
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <rect
+ style="opacity:1;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4507"
+ width="0.8018086"
+ height="4.1426778"
+ x="73.565933"
+ y="245.28334" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 73.705357,233.59449 h -5.197174 l 0.09449,-11.62276 H 43.845239"
+ id="path4509"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 73.327381,247.39062 h -5.480656 v 7.65402 H 43.845239"
+ id="path4511"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.265;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;marker-end:url(#Arrow1Lend)"
+ d="m 67.846725,247.39062 v -6.70907 h 5.480656"
+ id="path4513"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 77.296131,232.08259 v 16.91443 h 8.88244 v 26.17485"
+ id="path4797"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 119.2022,214.68099 v 28.0633 l 29.65347,-14.47247 z"
+ id="path4799"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 121.07309,221.89726 c 4.94449,0 4.81085,0 4.81085,0"
+ id="path4801"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 121.20673,233.92439 h 4.40994"
+ id="path4803"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 123.61215,219.62547 v 4.54358"
+ id="path4805"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 68.602671,221.97173 H 119.20221"
+ id="path4807"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect4809"
+ width="4.9444861"
+ height="14.833458"
+ x="156.88721"
+ y="200.5157" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 148.85567,228.27182 H 159.159 v -12.78903"
+ id="path4811"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 159.42627,189.55765 V 200.5157"
+ id="path4813"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 159.159,228.27182 v 48.14842"
+ id="path4815"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 118.93494,235.66164 h -11.75986 v 40.62497"
+ id="path4817"
+ inkscape:connector-curvature="0" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="90.337105"
+ y="280.29565"
+ id="text4821"><tspan
+ sodipodi:role="line"
+ id="tspan4819"
+ x="90.337105"
+ y="280.29565"
+ style="stroke-width:0.26458332px">Cycle</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="109.31324"
+ y="281.89926"
+ id="text4825"><tspan
+ sodipodi:role="line"
+ id="tspan4823"
+ x="109.31324"
+ y="281.89926"
+ style="stroke-width:0.26458332px">Uin</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="161.69806"
+ y="281.89926"
+ id="text4829"><tspan
+ sodipodi:role="line"
+ id="tspan4827"
+ x="161.69806"
+ y="281.89926"
+ style="stroke-width:0.26458332px">Out</tspan></text>
+ </g>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="120mm"
+ height="180mm"
+ viewBox="0 0 120 180"
+ version="1.1"
+ id="svg8"
+ inkscape:version="0.92.1 r15371"
+ sodipodi:docname="timing-diagram.svg">
+ <defs
+ id="defs2">
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="marker4933"
+ style="overflow:visible;"
+ inkscape:isstock="true">
+ <path
+ id="path4931"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+ transform="scale(0.8) rotate(180) translate(12.5,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4515"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
+ transform="scale(0.8) translate(12.5,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lend"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow1Lend"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4518"
+ d="M 0,0 5,-5 -12.5,0 5,5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="matrix(-0.8,0,0,-0.8,-10,0)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="228.07273"
+ inkscape:cy="341.28557"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1920"
+ inkscape:window-height="1163"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,-117)">
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.28704187px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 15.774506,127.14411 v 37.59712 h 68.008863"
+ id="path4850"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4852"
+ d="m 15.774506,182.51762 v 37.59712 h 68.008863"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.28704187px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.28704187px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 15.774506,238.83607 v 37.59712 h 68.008863"
+ id="path4854"
+ inkscape:connector-curvature="0" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="97.517853"
+ y="156.95981"
+ id="text4877"><tspan
+ sodipodi:role="line"
+ id="tspan4875"
+ x="97.517853"
+ y="156.95981"
+ style="stroke-width:0.26458332px">Cycle</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="99.407738"
+ y="212.90028"
+ id="text4881"><tspan
+ sodipodi:role="line"
+ id="tspan4879"
+ x="99.407738"
+ y="212.90028"
+ style="stroke-width:0.26458332px">U, C1</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="97.517853"
+ y="254.66666"
+ id="text4885"><tspan
+ sodipodi:role="line"
+ id="tspan4883"
+ x="97.517853"
+ y="254.66666"
+ style="stroke-width:0.26458332px">Out</tspan></text>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+ d="m 15.875,136.17113 h 9.071428 v 28.34821 h 49.325894"
+ id="path4887"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+ d="m 15.774506,220.11474 h 9.36091 l 58.074898,-33.52956"
+ id="path4889"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:0.79374995,0.26458332;stroke-dashoffset:0"
+ d="M 15.308036,192.86755 H 91.09226"
+ id="path4891"
+ inkscape:connector-curvature="0" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="99.785706"
+ y="194.00148"
+ id="text4895"><tspan
+ sodipodi:role="line"
+ id="tspan4893"
+ x="99.785706"
+ y="194.00148"
+ style="stroke-width:0.26458332px">Uin</tspan></text>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:0.26458332,0.79374995;stroke-dashoffset:0"
+ d="M 24.946428,164.51934 V 276.2113"
+ id="path4897"
+ inkscape:connector-curvature="0" />
+ <path
+ inkscape:connector-curvature="0"
+ id="path4899"
+ d="M 72.571428,164.70833 V 276.40029"
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:0.26458332, 0.79374995;stroke-dashoffset:0;stroke-opacity:1" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
+ d="M 15.497024,246.72916 H 72.38244 v 29.48214 l 7.181548,0.18899"
+ id="path4901"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow1Lstart);marker-end:url(#marker4933)"
+ d="m 25.324405,281.69196 46.680059,-0.18899"
+ id="path4903"
+ inkscape:connector-curvature="0" />
+ <text
+ xml:space="preserve"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52777767px;line-height:125%;font-family:sans-serif;-inkscape-font-specification:sans-serif;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:end;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ x="50.837795"
+ y="285.28275"
+ id="text4973"><tspan
+ sodipodi:role="line"
+ id="tspan4971"
+ x="50.837795"
+ y="285.28275"
+ style="stroke-width:0.26458332px">t</tspan></text>
+ </g>
+</svg>
--- /dev/null
+v 20130925 2
+C 40000 40000 0 0 0 title-B.sym
+C 49800 46300 1 0 0 opamp-2.sym
+{
+T 50600 47300 5 10 0 0 0 0 1
+device=OPAMP
+T 50600 47100 5 10 1 1 0 0 1
+refdes=IC1
+T 50600 47500 5 10 0 0 0 0 1
+symversion=0.1
+T 50500 46500 5 10 1 1 0 0 1
+value=PM211
+}
+C 46200 48500 1 180 0 pnp-2.sym
+{
+T 45600 48100 5 10 0 0 180 0 1
+device=PNP_TRANSISTOR
+T 45600 48000 5 10 1 1 180 0 1
+refdes=T3
+T 45100 47700 5 10 1 1 0 0 1
+value=BC559
+}
+C 45800 48900 1 90 0 resistor-2.sym
+{
+T 45450 49300 5 10 0 0 90 0 1
+device=RESISTOR
+T 45500 49100 5 10 1 1 90 0 1
+refdes=R3
+T 45800 49200 5 10 1 1 0 0 1
+value=10k
+}
+C 46800 45600 1 90 0 resistor-2.sym
+{
+T 46450 46000 5 10 0 0 90 0 1
+device=RESISTOR
+T 46500 45800 5 10 1 1 90 0 1
+refdes=R5
+T 46900 45900 5 10 1 1 0 0 1
+value=33k
+}
+C 46800 48900 1 90 0 resistor-2.sym
+{
+T 46450 49300 5 10 0 0 90 0 1
+device=RESISTOR
+T 46500 49100 5 10 1 1 90 0 1
+refdes=R4
+T 46800 49200 5 10 1 1 0 0 1
+value=18k
+}
+N 45700 42600 45700 47500 4
+N 45700 48900 45700 48500 4
+N 46700 48900 46700 46500 4
+N 46200 48000 46700 48000 4
+C 40600 49700 1 0 0 terminal-1.sym
+{
+T 40910 50450 5 10 0 0 0 0 1
+device=terminal
+T 40910 50300 5 10 0 0 0 0 1
+footprint=CONNECTOR 1 1
+T 40850 49750 5 10 1 1 0 6 1
+refdes=J2
+}
+C 40600 43100 1 0 0 terminal-1.sym
+{
+T 40910 43850 5 10 0 0 0 0 1
+device=terminal
+T 40910 43700 5 10 0 0 0 0 1
+footprint=CONNECTOR 1 1
+T 40850 43150 5 10 1 1 0 6 1
+refdes=J3
+}
+C 40600 50200 1 0 0 terminal-1.sym
+{
+T 40910 50950 5 10 0 0 0 0 1
+device=terminal
+T 40910 50800 5 10 0 0 0 0 1
+footprint=CONNECTOR 1 1
+T 40850 50250 5 10 1 1 0 6 1
+refdes=J1
+T 40600 50200 5 10 0 1 0 0 1
+value=3.3V
+}
+N 41500 49800 48600 49800 4
+N 41500 43200 49500 43200 4
+N 44700 43200 44700 45400 4
+N 46700 43200 46700 45600 4
+C 44200 45400 1 0 0 nmos-3.sym
+{
+T 44800 45900 5 10 0 0 0 0 1
+device=NMOS_TRANSISTOR
+T 44900 46000 5 10 1 1 0 0 1
+refdes=T2
+}
+N 44700 46200 44700 47000 4
+N 44700 47000 45700 47000 4
+C 43100 44200 1 0 0 npn-2.sym
+{
+T 43700 44700 5 10 0 0 0 0 1
+device=NPN_TRANSISTOR
+T 43700 44700 5 10 1 1 0 0 1
+refdes=T1
+T 43700 44500 5 10 1 1 0 0 1
+value=BC549
+}
+C 43700 46700 1 90 0 resistor-2.sym
+{
+T 43350 47100 5 10 0 0 90 0 1
+device=RESISTOR
+T 43400 46900 5 10 1 1 90 0 1
+refdes=R2
+T 43700 47000 5 10 1 1 0 0 1
+value=1k
+}
+N 43600 49800 43600 47600 4
+N 43600 46700 43600 45200 4
+N 43600 45600 44200 45600 4
+C 42000 44600 1 0 0 resistor-2.sym
+{
+T 42400 44950 5 10 0 0 0 0 1
+device=RESISTOR
+T 42200 44900 5 10 1 1 0 0 1
+refdes=R1
+T 42200 44400 5 10 1 1 0 0 1
+value=33k
+}
+N 42900 44700 43100 44700 4
+N 43600 44200 43600 43200 4
+T 50100 40700 9 10 1 0 0 0 1
+Single slope C meter
+N 49800 47100 45700 47100 4
+C 51400 47900 1 90 0 resistor-2.sym
+{
+T 51050 48300 5 10 0 0 90 0 1
+device=RESISTOR
+T 51100 48100 5 10 1 1 90 0 1
+refdes=R6
+T 51400 48300 5 10 1 1 0 0 1
+value=10k
+}
+N 41500 50300 51300 50300 4
+N 51300 50300 51300 48800 4
+N 51300 42000 51300 47900 4
+N 50900 46800 51300 46800 4
+N 42000 44700 42000 42000 4
+C 48700 48500 1 90 0 resistor-2.sym
+{
+T 48350 48900 5 10 0 0 90 0 1
+device=RESISTOR
+T 48400 48700 5 10 1 1 90 0 1
+refdes=R6
+T 48700 48900 5 10 1 1 0 0 1
+value=12k
+}
+C 48700 45200 1 90 0 resistor-2.sym
+{
+T 48350 45600 5 10 0 0 90 0 1
+device=RESISTOR
+T 48400 45400 5 10 1 1 90 0 1
+refdes=R7
+T 48100 45200 5 10 1 1 0 0 1
+value=39k
+}
+N 48600 46500 49800 46500 4
+N 48600 46100 48600 48500 4
+N 48600 49400 48600 49800 4
+T 41800 41600 9 10 1 0 0 0 1
+Cycle
+T 51000 41700 9 10 1 0 0 0 1
+Cmp Out
+N 48600 45200 48600 43200 4
+C 45800 41700 1 90 0 terminal-1.sym
+{
+T 45050 42010 5 10 0 0 90 0 1
+device=terminal
+T 45200 42010 5 10 0 0 90 0 1
+footprint=CONNECTOR 1 1
+T 45750 41950 5 10 1 1 90 6 1
+refdes=J4
+}
+C 46400 41700 1 90 0 terminal-1.sym
+{
+T 45650 42010 5 10 0 0 90 0 1
+device=terminal
+T 45800 42010 5 10 0 0 90 0 1
+footprint=CONNECTOR 1 1
+T 46350 41950 5 10 1 1 90 6 1
+refdes=J5
+}
+N 46300 42600 46300 43200 4
+C 45600 40800 1 0 0 capacitor-1.sym
+{
+T 45800 41500 5 10 0 0 0 0 1
+device=CAPACITOR
+T 45800 41300 5 10 1 1 0 0 1
+refdes=C?
+T 45800 41700 5 10 0 0 0 0 1
+symversion=0.1
+}
--- /dev/null
+v 20130925 2
+C 40000 40000 0 0 0 title-B.sym
+C 49800 46300 1 0 0 opamp-2.sym
+{
+T 50600 47300 5 10 0 0 0 0 1
+device=OPAMP
+T 50600 47100 5 10 1 1 0 0 1
+refdes=IC1
+T 50600 47500 5 10 0 0 0 0 1
+symversion=0.1
+T 50500 46500 5 10 1 1 0 0 1
+value=PM211
+}
+C 46200 48500 1 180 0 pnp-2.sym
+{
+T 45600 48100 5 10 0 0 180 0 1
+device=PNP_TRANSISTOR
+T 45600 48000 5 10 1 1 180 0 1
+refdes=T3
+T 45100 47700 5 10 1 1 0 0 1
+value=BC559
+}
+C 45800 48900 1 90 0 resistor-2.sym
+{
+T 45450 49300 5 10 0 0 90 0 1
+device=RESISTOR
+T 45500 49100 5 10 1 1 90 0 1
+refdes=R3
+T 45800 49200 5 10 1 1 0 0 1
+value=10k
+}
+C 46800 45600 1 90 0 resistor-2.sym
+{
+T 46450 46000 5 10 0 0 90 0 1
+device=RESISTOR
+T 46500 45800 5 10 1 1 90 0 1
+refdes=R5
+T 46900 45900 5 10 1 1 0 0 1
+value=33k
+}
+C 46800 48900 1 90 0 resistor-2.sym
+{
+T 46450 49300 5 10 0 0 90 0 1
+device=RESISTOR
+T 46500 49100 5 10 1 1 90 0 1
+refdes=R4
+T 46800 49200 5 10 1 1 0 0 1
+value=18k
+}
+C 45500 45600 1 270 0 capacitor-4.sym
+{
+T 46600 45400 5 10 0 0 270 0 1
+device=POLARIZED_CAPACITOR
+T 46000 45400 5 10 1 1 270 0 1
+refdes=C1
+T 46200 45400 5 10 0 0 270 0 1
+symversion=0.1
+T 45900 45000 5 10 1 1 0 0 1
+value=10uF
+}
+N 45700 47500 45700 45600 4
+N 45700 48900 45700 48500 4
+N 46700 48900 46700 46500 4
+N 46200 48000 46700 48000 4
+C 40600 49700 1 0 0 terminal-1.sym
+{
+T 40910 50450 5 10 0 0 0 0 1
+device=terminal
+T 40910 50300 5 10 0 0 0 0 1
+footprint=CONNECTOR 1 1
+T 40850 49750 5 10 1 1 0 6 1
+refdes=J2
+}
+C 40600 43100 1 0 0 terminal-1.sym
+{
+T 40910 43850 5 10 0 0 0 0 1
+device=terminal
+T 40910 43700 5 10 0 0 0 0 1
+footprint=CONNECTOR 1 1
+T 40850 43150 5 10 1 1 0 6 1
+refdes=J3
+}
+C 40600 50200 1 0 0 terminal-1.sym
+{
+T 40910 50950 5 10 0 0 0 0 1
+device=terminal
+T 40910 50800 5 10 0 0 0 0 1
+footprint=CONNECTOR 1 1
+T 40850 50250 5 10 1 1 0 6 1
+refdes=J1
+T 40600 50200 5 10 0 1 0 0 1
+value=3.3V
+}
+N 41500 49800 48600 49800 4
+N 41500 43200 46700 43200 4
+N 44700 43200 44700 45400 4
+N 46700 43200 46700 45600 4
+C 44200 45400 1 0 0 nmos-3.sym
+{
+T 44800 45900 5 10 0 0 0 0 1
+device=NMOS_TRANSISTOR
+T 44900 46000 5 10 1 1 0 0 1
+refdes=T2
+}
+N 45700 43200 45700 44700 4
+N 44700 46200 44700 47000 4
+N 44700 47000 45700 47000 4
+C 43100 44200 1 0 0 npn-2.sym
+{
+T 43700 44700 5 10 0 0 0 0 1
+device=NPN_TRANSISTOR
+T 43700 44700 5 10 1 1 0 0 1
+refdes=T1
+T 43700 44500 5 10 1 1 0 0 1
+value=BC549
+}
+C 43700 46700 1 90 0 resistor-2.sym
+{
+T 43350 47100 5 10 0 0 90 0 1
+device=RESISTOR
+T 43400 46900 5 10 1 1 90 0 1
+refdes=R2
+T 43700 47000 5 10 1 1 0 0 1
+value=1k
+}
+N 43600 49800 43600 47600 4
+N 43600 46700 43600 45200 4
+N 43600 45600 44200 45600 4
+C 42000 44600 1 0 0 resistor-2.sym
+{
+T 42400 44950 5 10 0 0 0 0 1
+device=RESISTOR
+T 42200 44900 5 10 1 1 0 0 1
+refdes=R1
+T 42200 44400 5 10 1 1 0 0 1
+value=33k
+}
+N 42900 44700 43100 44700 4
+N 43600 44200 43600 43200 4
+T 50100 40700 9 10 1 0 0 0 1
+Single slope volt meter
+N 49800 47100 45700 47100 4
+N 49000 46500 49800 46500 4
+C 51400 47900 1 90 0 resistor-2.sym
+{
+T 51050 48300 5 10 0 0 90 0 1
+device=RESISTOR
+T 51100 48100 5 10 1 1 90 0 1
+refdes=R6
+T 51400 48300 5 10 1 1 0 0 1
+value=10k
+}
+N 41500 50300 51300 50300 4
+N 51300 50300 51300 48800 4
+N 51300 42000 51300 47900 4
+N 50900 46800 51300 46800 4
+N 42000 44700 42000 42000 4
+C 48600 46600 1 180 0 resistor-2.sym
+{
+T 48200 46250 5 10 0 0 180 0 1
+device=RESISTOR
+T 48400 46300 5 10 1 1 180 0 1
+refdes=R7
+T 47900 46000 5 10 1 1 0 0 1
+value=1.2M
+}
+C 48700 48500 1 90 0 resistor-2.sym
+{
+T 48350 48900 5 10 0 0 90 0 1
+device=RESISTOR
+T 48400 48700 5 10 1 1 90 0 1
+refdes=R6
+T 48700 48900 5 10 1 1 0 0 1
+value=560k
+}
+C 49100 45200 1 90 0 resistor-2.sym
+{
+T 48750 45600 5 10 0 0 90 0 1
+device=RESISTOR
+T 48800 45400 5 10 1 1 90 0 1
+refdes=R8
+T 48500 45200 5 10 1 1 0 0 1
+value=150k
+}
+C 49300 46100 1 270 0 capacitor-4.sym
+{
+T 50400 45900 5 10 0 0 270 0 1
+device=POLARIZED_CAPACITOR
+T 49800 45900 5 10 1 1 270 0 1
+refdes=C2
+T 50000 45900 5 10 0 0 270 0 1
+symversion=0.1
+T 49800 45400 5 10 1 1 0 0 1
+value=1uF
+}
+N 45700 43200 49500 43200 4
+N 49500 43200 49500 45200 4
+N 49000 45200 49000 43200 4
+N 49500 46100 49000 46100 4
+N 49000 46100 49000 46500 4
+N 49200 46500 48600 46500 4
+N 48600 46500 48600 48500 4
+N 47700 46500 47400 46500 4
+N 47400 46500 47400 42000 4
+N 48600 49400 48600 49800 4
+T 47200 41700 9 10 1 0 0 0 1
+Uin
+T 41800 41600 9 10 1 0 0 0 1
+Cycle
+T 51000 41700 9 10 1 0 0 0 1
+Cmp Out
--- /dev/null
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <pigpiod_if2.h>
+
+
+#define CYCLE_OUT 18 // The cycle output
+#define CMP_IN 17 // The signal from the comparator
+#define NR_SAMPLES 20 // Number of samples to avaerage out the jitter
+
+void gpio_callback(int pi, unsigned user_gpio, unsigned level, uint32_t tick, void * userdata);
+
+#define INPUT_OFFSET 0.97
+#define INPUT_DIVIDER 0.086
+#define SLOPE_FACTOR 38.7 // Current / Voltage ( 117uA / 3.0V)
+
+class DVM
+{
+ int pi; // Connection to pigpio daemon
+ unsigned cycle_gate; // The gate to run a measurement cycle
+ unsigned comparator; // The signal from the comparator
+
+
+ uint32_t last_tick;
+ uint32_t measure_start;
+
+ uint32_t samples[NR_SAMPLES];
+ int sample_index;
+
+ float U; // The measured voltage
+
+
+public:
+
+ void input_event(unsigned gpio, unsigned level, uint32_t tick)
+ {
+ float measure_time;
+
+ //printf("Input event: input %u = %u, %d\n", gpio, level, tick - last_tick);
+
+ if (gpio == cycle_gate && level == 1)
+ {
+ measure_start = tick;
+ }
+
+ if (gpio == comparator && level == 1)
+ {
+ samples[sample_index++] = tick - measure_start;
+ sample_index %= NR_SAMPLES;
+
+ measure_time = (float)(tick - measure_start) / 1.0e6;
+ U = measure_time * 11.4 - INPUT_OFFSET;
+ U /= INPUT_DIVIDER;
+
+ gpio_write(pi, cycle_gate, 0);
+ }
+ if (gpio == comparator && level == 0)
+ {
+ gpio_write(pi, cycle_gate, 1);
+ }
+ last_tick = tick;
+ }
+
+
+ DVM(int pi_connection, unsigned gate, unsigned cmp)
+ {
+ int open_return;
+
+ pi = pi_connection;
+ cycle_gate = gate;
+ comparator = cmp;
+
+ last_tick = 0;
+ sample_index = 0;
+
+
+ set_mode(pi, comparator, PI_INPUT);
+ set_mode(pi, cycle_gate, PI_OUTPUT);
+ set_pull_up_down(pi, comparator, PI_PUD_OFF);
+
+ open_return = callback_ex(pi, cycle_gate, EITHER_EDGE, gpio_callback, this);
+ //fprintf(stderr, "Set callback returns %d.\n", open_return);
+ open_return = callback_ex(pi, comparator, EITHER_EDGE, gpio_callback, this);
+ //fprintf(stderr, "Set callback returns %d.\n", open_return);
+ gpio_write(pi, cycle_gate, 0);
+ sleep(1);
+ gpio_write(pi, cycle_gate, 1);
+ }
+
+ float Voltage()
+ {
+ uint32_t sum = 0;
+ uint32_t average_time;
+ float measure_time;
+
+ // To filter out the jitter, calculate the average measured time
+
+ for (int i = 0; i < NR_SAMPLES; i++)
+ {
+ sum += samples[i];
+ }
+
+ average_time = (sum / NR_SAMPLES) >> 5 << 5;
+ std::cout << " Average time = " << average_time << "\n";
+ measure_time = average_time / 1.0e6;
+ U = measure_time * SLOPE_FACTOR;
+
+ return U;
+ }
+};
+
+void gpio_callback(int pi, unsigned user_gpio, unsigned level, uint32_t tick, void * userdata)
+{
+ DVM *sensor;
+
+ sensor = (DVM *)userdata;
+ sensor->input_event(user_gpio, level, tick);
+}
+
+
+int main()
+{
+ int pi;
+ std::ofstream sensorfile;
+
+ pi = pigpio_start(NULL, NULL);
+ if (pi < 0)
+ {
+ // pigpio initialisation failed.
+ fprintf(stderr, "GPIO initialization failed.\n");
+
+ }
+ else
+ {
+ // pigpio initialised okay.
+ DVM sensor(pi, CYCLE_OUT, CMP_IN);
+
+ while (true)
+ {
+ sleep(1);
+ printf("%.3f\n", sensor.Voltage());
+ fflush(stdout);
+
+ sensorfile.open("sensor1");
+ sensorfile << std::fixed << std::setprecision(3) << sensor.Voltage() << " uF\n";
+ sensorfile.close();
+ }
+ pigpio_stop(pi);
+
+ }
+
+}
+
--- /dev/null
+bin_PROGRAMS = tsic pulsewidth voltmeter Cmeter meters
+
+
+tsic_SOURCES = tsic.cpp
+pulsewidth_SOURCES = pulsewidth.cpp
+voltmeter_SOURCES = voltmeter.cpp
+Cmeter_SOURCES = Cmeter.cpp
+meters_SOURCES = meters.cpp
--- /dev/null
+#include <wx/wx.h>
+#include <wx/textfile.h>
+
+class MyApp: public wxApp
+{
+public:
+ virtual bool OnInit();
+};
+
+class MyFrame: public wxFrame
+{
+public:
+ MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
+private:
+ void OnHello(wxCommandEvent& event);
+ void OnExit(wxCommandEvent& event);
+ void OnAbout(wxCommandEvent& event);
+ wxDECLARE_EVENT_TABLE();
+};
+
+class SensorDisplay : public wxPanel
+{
+ int sensorvalue;
+ wxTimer *timer;
+
+public:
+ SensorDisplay(wxFrame *parent);
+ void OnPaint(wxPaintEvent& event);
+ void OnTimer(wxCommandEvent& event);
+};
+
+SensorDisplay::SensorDisplay(wxFrame *parent)
+ : wxPanel(parent, -1, wxPoint(-1, -1), wxSize(-1, -1), wxBORDER_SUNKEN)
+{
+ sensorvalue = 0;
+ wxColour background(wxT("LIGHT STEEL BLUE"));
+
+ SetBackgroundColour(background);
+
+ timer = new wxTimer(this, 1);
+ this->Connect(wxEVT_PAINT, wxPaintEventHandler(SensorDisplay::OnPaint));
+ Connect(wxEVT_TIMER, wxCommandEventHandler(SensorDisplay::OnTimer));
+
+ timer->Start(500);
+}
+
+void SensorDisplay::OnPaint(wxPaintEvent& event)
+{
+ wxString displayed_value;
+
+ wxFont display_font(36, wxFONTFAMILY_MODERN,wxFONTSTYLE_NORMAL,
+ wxFONTWEIGHT_BOLD, false);
+
+ sensorvalue++;
+ displayed_value.Printf(wxT("%04d"), sensorvalue);
+
+ wxTextFile sensorfile(wxT("sensor1"));
+ sensorfile.Open();
+ displayed_value = sensorfile.GetFirstLine();
+
+ wxPaintDC dc(this);
+
+ dc.SetFont(display_font);
+
+ dc.DrawText(displayed_value, 60, 80);
+}
+
+void SensorDisplay::OnTimer(wxCommandEvent& event)
+{
+ sensorvalue += 10;
+ Refresh();
+}
+
+enum
+{
+ ID_Hello = 1
+};
+
+wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
+ EVT_MENU(ID_Hello, MyFrame::OnHello)
+ EVT_MENU(wxID_EXIT, MyFrame::OnExit)
+ EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
+wxEND_EVENT_TABLE()
+
+wxIMPLEMENT_APP(MyApp);
+
+bool MyApp::OnInit()
+{
+ MyFrame *frame = new MyFrame( "Sensors", wxPoint(50, 50), wxSize(450, 340) );
+ frame->Show( true );
+ return true;
+}
+
+MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
+ : wxFrame(NULL, wxID_ANY, title, pos, size)
+{
+ wxMenu *menuFile = new wxMenu;
+ menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
+ "Help string shown in status bar for this menu item");
+ menuFile->AppendSeparator();
+ menuFile->Append(wxID_EXIT);
+ wxMenu *menuHelp = new wxMenu;
+ menuHelp->Append(wxID_ABOUT);
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append( menuFile, "&File" );
+ menuBar->Append( menuHelp, "&Help" );
+ SetMenuBar( menuBar );
+
+ SensorDisplay *display = new SensorDisplay(this);
+
+ CreateStatusBar();
+ SetStatusText( "Raspberry Pi sensors" );
+}
+
+void MyFrame::OnExit(wxCommandEvent& event)
+{
+ Close( true );
+}
+
+void MyFrame::OnAbout(wxCommandEvent& event)
+{
+ wxMessageBox( "Raspberry Pi sensor display version 1.0",
+ "About Sensors...", wxOK | wxICON_INFORMATION );
+}
+
+void MyFrame::OnHello(wxCommandEvent& event)
+{
+ wxLogMessage("Hello from sensors!");
+}
+
--- /dev/null
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <pigpiod_if2.h>
+
+
+#define CMP_IN 22 // The signal from the comparator
+#define NR_SAMPLES 20
+
+void gpio_callback(int pi, unsigned user_gpio, unsigned level, uint32_t tick, void * userdata);
+
+
+class DVM
+{
+ int pi; // Connection to pigpio daemon
+ unsigned comparator; // The signal from the comparator
+
+
+ uint32_t last_tick;
+ uint32_t measure_start;
+
+ uint32_t samples[NR_SAMPLES];
+ int sample_index;
+
+public:
+
+ void input_event(unsigned gpio, unsigned level, uint32_t tick)
+ {
+ //printf("Input event: input %u = %u, %d\n", gpio, level, tick - last_tick);
+
+
+ if (gpio == comparator && level == 1)
+ {
+ measure_start = tick;
+ }
+ if (gpio == comparator && level == 0)
+ {
+ samples[sample_index] = tick - measure_start;
+ //printf(" Measured time = %d\n", tick - measure_start);
+ sample_index++;
+ if (sample_index == NR_SAMPLES)
+ {
+ uint32_t min = samples[0];
+ uint32_t max = samples[0];
+ uint32_t sum = 0;
+
+ for (int i = 0; i < NR_SAMPLES; i++)
+ {
+ sum += samples[i];
+ if (samples[i] > max) max = samples[i];
+ if (samples[i] < min) min = samples[i];
+ }
+ printf("Min = %d, Max = %d, Middle = %d, Avg = %d\n", min, max, (min + max) / 2, (sum / NR_SAMPLES) >> 5 << 5);
+
+ sample_index = 0;
+ }
+ }
+ last_tick = tick;
+ }
+
+
+ DVM(int pi_connection, unsigned cmp)
+ {
+ int open_return;
+
+ pi = pi_connection;
+ comparator = cmp;
+
+ last_tick = 0;
+ sample_index = 0;
+
+
+ set_mode(pi, comparator, PI_INPUT);
+ set_pull_up_down(pi, comparator, PI_PUD_OFF);
+ set_glitch_filter(pi, comparator, 200);
+
+ open_return = callback_ex(pi, comparator, EITHER_EDGE, gpio_callback, this);
+ fprintf(stderr, "Set callback returns %d.\n", open_return);
+ }
+
+};
+
+void gpio_callback(int pi, unsigned user_gpio, unsigned level, uint32_t tick, void * userdata)
+{
+ DVM *sensor;
+
+ sensor = (DVM *)userdata;
+ sensor->input_event(user_gpio, level, tick);
+}
+
+
+int main()
+{
+ int pi;
+ std::ofstream sensorfile;
+
+ pi = pigpio_start(NULL, NULL);
+ if (pi < 0)
+ {
+ // pigpio initialisation failed.
+ fprintf(stderr, "GPIO initialization failed.\n");
+
+ }
+ else
+ {
+ // pigpio initialised okay.
+ DVM sensor(pi, CMP_IN);
+
+ while (true)
+ {
+ sleep(1);
+ //printf("%.3f\r", sensor.Voltage());
+ //fflush(stdout);
+
+ }
+ pigpio_stop(pi);
+
+ }
+
+}
+
--- /dev/null
+#include <iostream>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <pigpiod_if2.h>
+
+enum SerialState
+{
+ INITIAL, WAIT_START, START_BIT, AWAIT_BIT, INSIDE_BIT, PARITY_BIT, STOP_BIT
+
+};
+
+#define TSIC_INPUT 4 // The sensor is connected to GPIO 4
+
+void gpio_callback(int pi, unsigned user_gpio, unsigned level, uint32_t tick, void * userdata);
+
+class Tsic
+{
+ int pi; // Connection to pigpio daemon
+ unsigned gpio; // Input pin of the temparature sensor
+
+ uint32_t last_high_tick;
+ uint32_t last_low_tick;
+
+ uint32_t half_bit_time;
+
+ SerialState serial_state;
+
+ int bitcount;
+ unsigned char received_byte;
+ int byte_count;
+ unsigned char input_buffer[2];
+ long temperature; // T * 100
+
+public:
+
+ void input_event(unsigned level, uint32_t tick)
+ {
+
+ switch (serial_state)
+ {
+ case INITIAL:
+ if (level == 1)
+ {
+ last_high_tick = tick;
+ serial_state = WAIT_START;
+ }
+ break;
+
+ case WAIT_START:
+ if (level == 0 && tick - last_high_tick > 3000)
+ {
+ last_low_tick = tick;
+ serial_state = START_BIT;
+ }
+ break;
+
+ case START_BIT: // 2
+ if (level == 1)
+ {
+ half_bit_time = tick - last_low_tick;
+ bitcount = 0;
+ received_byte = 0;
+ serial_state = AWAIT_BIT;
+ }
+ break;
+
+ case AWAIT_BIT: // 3
+ if (level == 0)
+ {
+ last_low_tick = tick;
+ serial_state = INSIDE_BIT;
+ }
+ break;
+
+ case INSIDE_BIT: // 4
+ if (level == 1)
+ {
+ unsigned bit = 0;
+
+ if (tick - last_low_tick < half_bit_time)
+ {
+ bit = 1;
+ }
+ bitcount++;
+ if (bitcount < 9)
+ {
+ received_byte <<= 1;
+ received_byte |= bit;
+ serial_state = AWAIT_BIT;
+ }
+ else
+ {
+ input_buffer[byte_count++] = received_byte;
+ if (byte_count == 2)
+ {
+ unsigned int sensor_value = input_buffer[0] * 256 + input_buffer[1];
+ temperature = sensor_value * 20000 / 2047 - 5000;
+ std::cout << " Temperature = " << temperature << "\n";
+ byte_count = 0;
+ }
+ received_byte = 0;
+ serial_state = STOP_BIT;
+ }
+ }
+ break;
+
+ case PARITY_BIT: // 5
+ if (level == 1)
+ {
+ serial_state = STOP_BIT;
+ }
+ break;
+ case STOP_BIT: // 6
+ if (level == 0)
+ {
+ serial_state = START_BIT;
+ last_low_tick = tick;
+ }
+ break;
+ }
+ }
+
+ Tsic(int pi_connection, unsigned input)
+ {
+ pi = pi_connection;
+ gpio = input;
+
+ last_high_tick = 0;
+ last_low_tick = 0;
+
+ half_bit_time = 60;
+
+ serial_state = INITIAL;
+
+ bitcount = 0;
+ received_byte = 0;
+ byte_count = 0;
+ temperature = 0; // T * 100
+
+ set_mode(pi, gpio, PI_INPUT);
+ set_pull_up_down(pi, gpio, PI_PUD_OFF);
+
+ int open_return = callback_ex(pi, gpio, EITHER_EDGE, gpio_callback, this);
+ fprintf(stderr, "Set callback returns %d.\n", open_return);
+ }
+
+ long T()
+ {
+ return temperature;
+ }
+};
+
+void gpio_callback(int pi, unsigned user_gpio, unsigned level, uint32_t tick, void * userdata)
+{
+ Tsic *sensor;
+
+ sensor = (Tsic *)userdata;
+ sensor->input_event(level, tick);
+}
+
+
+int main()
+{
+ int pi;
+
+ pi = pigpio_start(NULL, NULL);
+ if (pi < 0)
+ {
+ // pigpio initialisation failed.
+ fprintf(stderr, "GPIO initialization failed.\n");
+
+ }
+ else
+ {
+ // pigpio initialised okay.
+ Tsic sensor(pi, TSIC_INPUT);
+
+
+ sleep(2);
+ std::cout << "The last temperature = " << sensor.T() / 100 << "." << sensor.T() % 100 << " Celcius.\n";
+ pigpio_stop(pi);
+
+ }
+
+}
+
--- /dev/null
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <pigpiod_if2.h>
+
+
+#define CYCLE_OUT 18 // The cycle output
+#define CMP_IN 17 // The signal from the comparator
+#define NR_SAMPLES 20 // Number of samples to avaerage out the jitter
+
+void gpio_callback(int pi, unsigned user_gpio, unsigned level, uint32_t tick, void * userdata);
+
+#define INPUT_OFFSET 0.97
+#define INPUT_DIVIDER 0.086
+#define SLOPE_FACTOR 11.4 // Current / Capacitance
+
+class DVM
+{
+ int pi; // Connection to pigpio daemon
+ unsigned cycle_gate; // The gate to run a measurement cycle
+ unsigned comparator; // The signal from the comparator
+
+
+ uint32_t last_tick;
+ uint32_t measure_start;
+
+ uint32_t samples[NR_SAMPLES];
+ int sample_index;
+
+ float U; // The measured voltage
+
+
+public:
+
+ void input_event(unsigned gpio, unsigned level, uint32_t tick)
+ {
+ float measure_time;
+
+ //printf("Input event: input %u = %u, %d\n", gpio, level, tick - last_tick);
+
+ if (gpio == cycle_gate && level == 1)
+ {
+ measure_start = tick;
+ }
+
+ if (gpio == comparator && level == 1)
+ {
+ samples[sample_index++] = tick - measure_start;
+ sample_index %= NR_SAMPLES;
+
+ measure_time = (float)(tick - measure_start) / 1.0e6;
+ U = measure_time * 11.4 - INPUT_OFFSET;
+ U /= INPUT_DIVIDER;
+
+ gpio_write(pi, cycle_gate, 0);
+ }
+ if (gpio == comparator && level == 0)
+ {
+ gpio_write(pi, cycle_gate, 1);
+ }
+ last_tick = tick;
+ }
+
+
+ DVM(int pi_connection, unsigned gate, unsigned cmp)
+ {
+ int open_return;
+
+ pi = pi_connection;
+ cycle_gate = gate;
+ comparator = cmp;
+
+ last_tick = 0;
+ sample_index = 0;
+
+
+ set_mode(pi, comparator, PI_INPUT);
+ set_mode(pi, cycle_gate, PI_OUTPUT);
+ set_pull_up_down(pi, comparator, PI_PUD_OFF);
+
+ open_return = callback_ex(pi, cycle_gate, EITHER_EDGE, gpio_callback, this);
+ //fprintf(stderr, "Set callback returns %d.\n", open_return);
+ open_return = callback_ex(pi, comparator, EITHER_EDGE, gpio_callback, this);
+ //fprintf(stderr, "Set callback returns %d.\n", open_return);
+ gpio_write(pi, cycle_gate, 0);
+ sleep(1);
+ gpio_write(pi, cycle_gate, 1);
+ }
+
+ float Voltage()
+ {
+ uint32_t sum = 0;
+ uint32_t average_time;
+ float measure_time;
+
+ // To filter out the jitter, calculate the average measured time
+
+ for (int i = 0; i < NR_SAMPLES; i++)
+ {
+ sum += samples[i];
+ }
+
+ average_time = (sum / NR_SAMPLES) >> 5 << 5;
+ std::cout << " Average time = " << average_time << "\n";
+ measure_time = average_time / 1.0e6;
+ U = measure_time * SLOPE_FACTOR - INPUT_OFFSET;
+ U /= INPUT_DIVIDER;
+
+ return U;
+ }
+};
+
+void gpio_callback(int pi, unsigned user_gpio, unsigned level, uint32_t tick, void * userdata)
+{
+ DVM *sensor;
+
+ sensor = (DVM *)userdata;
+ sensor->input_event(user_gpio, level, tick);
+}
+
+
+int main()
+{
+ int pi;
+ std::ofstream sensorfile;
+
+ pi = pigpio_start(NULL, NULL);
+ if (pi < 0)
+ {
+ // pigpio initialisation failed.
+ fprintf(stderr, "GPIO initialization failed.\n");
+
+ }
+ else
+ {
+ // pigpio initialised okay.
+ DVM sensor(pi, CYCLE_OUT, CMP_IN);
+
+ while (true)
+ {
+ sleep(1);
+ printf("%.3f\n", sensor.Voltage());
+ fflush(stdout);
+
+ sensorfile.open("sensor1");
+ sensorfile << std::fixed << std::setprecision(1) << sensor.Voltage() << "\n";
+ sensorfile.close();
+ }
+ pigpio_stop(pi);
+
+ }
+
+}
+