Counting Poo

From Nottinghack Wiki
Jump to navigation Jump to search
Counting Poo
LatrineSensor RemoteUnit V1 Annotated.jpg
Primary Contact Matt Little
Created 13/01/2014
Completed {{{completeddate}}}
Dormant {{{dormantdate}}}
Version {{{version}}}
Members {{{members}}}
Manufacturer {{{manufacturer}}}
Model {{{model}}}
Location [[{{{location}}}]]
GitHub / Repo {{{repo}}}
Status Dormant
Type Members Project
Live Status {{{livestatus}}}
QR code


This is a project via Nicola Greene to assist International NGO, Water for People with their work in Uganda.

The NGO install latrines in various urban and rural areas in Uganda. They have been having an issue with the fill rates of the latrines and are wanting to get real data on the use of the latrines. This means recoding visits to the latrines and counting the number of flushes made. Knowledge of the volume and weight of the deposits made each visit would be an added bonus.

A good overview of the problem and project is available here: For more on why sanitation is important:

The device must be:

  • Robust
  • Easy to install on existing equipment
  • Low cost ($50-$200 budget per unit)


See Counting Poo/Ideas for a record of possible project enhancements.

Hackday 11/1/14

Primary Objective:

  • Produce a prototype to monitor a 'flush' event and record that data.

Secondary Objectives:

  • Determine flush volume
  • Determine solid/liquid proportion in flush
  • Determine pit volume

Brainstormed ideas

Flush Sensing

Idea Description Advantages Disadvantages
Mechanical Flap A hinged/moving cover on the waste pipe outflow that is moved by a flush. Simple and robust.
Maintainable in-situ.
Low or zero power.
Risk of causing blockage.
Metallic components will corrode in high humidity/heat?
Beam break (across pipe) An IR/visible light beam is transmitted across the pipe. A flush breaks the beam. Cheap components
Solid-state solution
Waste on either transmitter or receiver will cause false readings
Reflective Sensor An IR/visible Tx/Rx pair is underneath the outflow pipe. The beam is reflected by a flush into the receiver. Cheap components
Solid-state solution
Can be "baffled" to stop waste interfering with sensing
Can waste be completely eliminated from getting in the way?
Temperature Sensor A temperature sensor (probably a thermistor) is mounted on/in the waste pipe. A flush changes the temperature. Cheap components
Solid-state solution
Not affected by buildup of waste (unless large amounts are present
Relies on temperature difference between waste and ambient pit temperature
May be too slow to react to changes
May have to be placed within flow, possible restriction/blockage
May require designing to be flush with pipe surface
Piezo/microphone Sensor A piezo or microphone is placed on the pipe. A flush causes vibrations that are picked up and amplified for sensing. Solid-state solution Requires significant analog circuitry for signal conditioning
Requires significant software for signal processing
Unknown effect of other vibration sources (e.g. nearby road)
Possible that waste on sensor will dampen/alter vibration characteristics
Moisture Sensor A moisture sensor is placed within the pipe. A flush changes the resistance of the sensor. Low cost, solid-state solution Has to be placed within flow, possible restriction/blockage
May require designing to be flush with pipe surface

Waste Volume Sensing

Ultrasonic Sensor An ultrasonic Tx/Rx pair placed on the pit lid will measure distance from lid to top-of-waste
With knowledge of the dimensions of the pit, this will allow volume calculation.
Non-contact, solid-state sensing Relatively high cost
Must be calibrate to pit dimensions for best data
Likely to be incompatible with "tiger worm tray" composting addition?
Resistive/Capacitive Sensor A series of sensors on a "pole" mounted vertically in the pit will be used to measure depth. Potential to be very simple, low-cost solution Sensors in contact with waste need to be protected against corrosion

Tested ideas



The basic circuit was a 10K thermistor and 10K resistor forming a potential divider. The voltage was measured with an oscilloscope/Arduino.


A thermistor placed on the outside of the pipe is not suitable. The pipe conducts heat too slowly, and the heat transfer for one flush is very low.

A thermistor placed within the pipe (as flush to surface as possible) was more successful. A large voltage change was apparent when a flush occurred.


With careful design to mitigate risk of blockage due to obstruction in pipe, this method shows promise.

The requirement that there be a temperature difference between waste and ambient remains a concern.

This method may have to be used in conjunction with other sensors.

IR beam

We used the Velleman MK120 IR Light Barrier kit. Schematic is here. Buy it here.

This worked quite for sensing liquids and solids passing by. The IR beam reflects off anything coming down the pipe. This will be recorded as a 'flush' event. The IR beam will flicker on/off so some filtering would be required for this to convert the data stream into a single 'flush'.

The Velleman kit flashes the IR at a particular frequency. Only this frequency is monitored, which helps to stop 'false' readings. This will probably need to be implemented in software/hardware.

The IR sensor was the most reliable of the detection methods tried.

Problems include:

  • High power (if left on all the time)
  • More circuitry required
  • Accurate set-up required


Note : The piezo sensor was discounted at an early stage due to low sensitivity to mild vibration.


A standard electret microphone amplifier circuit was built using a TL081 op-amp. The output waveform was measured with an oscilloscope.


The circuit is capable of picking up the sound/vibration from a flush


While the principle of detection with sound/vibration is good, in practice the complexity of designing a robust solution renders this idea impractical.


Using a node system:

Node is placed in the tank. It sends data up to the recorder (Dataduino) via a serial connection at 4800 baud.

The recorder has been set into low-power mode. This is only woken when data is received on the Rx of the serial line. To do this there have been a couple of changes to the DataDuino circuit. The clock output from the RTC is not needed as the interrupt, so this track has been cut. The device should wake when data appears on the Rx, so I have connected the Rx to D2 (Interrupt 0) with a 330 ohm resistor. When data is sent on the serial line then it wakes up the unit for <5 seconds.

Data will be sent in the LLAP format, which is basically a 12 char string, starting with 'a' then a 2 char ID then 9 chars of information.

Data must be sent in the format:

--any data---<CR>a???????????

--any data--- just wakes the unit up. The <CR> (carriage return) sets the data starting point. The LLAP format data can then be sent. This is only recorded if it matches the correct format, otherwise it is discarded.

Data is reocrded with a timestamp to a human-readable .csv file on an SD card.

Sensor unit design

See Version 1 page for information on the first prototype sensor unit

Recorder design

Power supply design

The recorder takes around 4-5mA. It required 3.5-5V supply.

A pack of 3 x AA batteries (2000mAh) would last around 400hours = 16 days. A pack of 3 x D batteries (12000mAh) would last around 2400hours = 100 days.

The power supply is probably best as a recharged power pack. This could cope with grid-intermittency. So a pack of 3 x D or C cells, with a re-purposed mobile phone charger would proabbly be best (and phone chargers relatively available in lots of places for the lcoal grid.

Enclosure design

To Do

This project is managed on Trello.

Version 1

The prototype details are available here