Lesson 8 Motion Tap - Water-Monitor/IoT-Portfolio-FJS GitHub Wiki

Motion Tap

The motion tap should work like the taps in public bathrooms: You get closer and it will give you water. You go away and the water will stop. This should help to save water, if no one is using the tap.

Step by step

  • First, plug the ultra-sonic sensor into the breadboard and get a Wemus.
  • Put in the cables like this:

Cable management acustic sensor

  • Create a new node and change the setup code
  • Get the topic motionSensor/distance and add it as an MQTT_IN node in node-red
  • Add a gauge node and draw a line between the two of them. Make sure to enlarge the ratio of the gauge from 10 to 1000
  • Set an if-operator with <130 (on) and >130 (off) statements.
  • Add a switch which reads the off/on outputs

Unplug the ultrasonic system and put it into another power supply, otherwise the next program will overwrite the existing progress on the Wemus.

  • Get a relay and a wemus and stick them together correctly
  • In IotEmpire, create a new node and get the output code from github. Do not use ‘relay’ as an output, because it is not working. ‘relais’ was the only option that worked. Set the Pin to D1.
  • As soon as this is working, get a pump and a 12V power supply
  • Since the cable of the pump was very lose, we had to first solder it back together
  • Put the cables like on the foto

Cable management pump

  • Be careful: the pump should not run without water for too long
  • Add in Node-red a MQTT_OUT and add the topic ‘relay/pump/set’ to it
  • Connect the switch with the new mqtt node
  • Deploy everything and as soon as you get close enough (<130 units) the pump will go on