Bicycle pedal motion status
This is an add-on flow of the Pi-loton project using reed sensors to detect RPM and in return, could output a speed and estimated distance traveled. Warning: this flow has many caveats and bugs.
Reed Sensors :
There are 3 sensors mounted at my bicycle. One at the bottom tube, one at the seat stay and one at the chain stay.
The flow follows as simple sequence. reed sensors are labelled A,B,C,. signals of the switch are then join to "abc, bca, cab" and "acb, cba , bac" and were set with their respected directions. See and try flow below.
Switch "B" which is my preferred mounting point. This also acts like a reference point and reset switch incase direction output is wrong.
The intention of this project is to try and observed if reed switches can be use detect pedal direction. As per observation yes it is possible but as per accuracy no its not accurate.
Any feed backs, comments and improvements of the flow are highly welcome
[{"id":"5a5ea2f2.e652dc","type":"rpi-gpio in","z":"eee72f37.6dc038","name":"Pedal Sensor","pin":"35","intype":"up","debounce":"25","read":false,"x":98.4285659790039,"y":374.00000858306885,"wires":[["4d5a13de.9b38ec","e7ea3d50.4b1b6","ee89f341.369cf"]]},{"id":"4d5a13de.9b38ec","type":"switch","z":"eee72f37.6dc038","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":283.14286041259766,"y":377.71429538726807,"wires":[["a686b3b8.402338","5e583096.8f9a9"]]},{"id":"4be262be.0a4aac","type":"rpi-gpio in","z":"eee72f37.6dc038","name":"","pin":"32","intype":"up","debounce":"25","read":false,"x":102.515625,"y":435.5078363418579,"wires":[["18da1e1b.52a292"]]},{"id":"97fddab6.9b9728","type":"rpi-gpio in","z":"eee72f37.6dc038","name":"","pin":"29","intype":"up","debounce":"25","read":false,"x":101.51171875,"y":496.7422113418579,"wires":[["745d4ea2.4ba37"]]},{"id":"5e583096.8f9a9","type":"change","z":"eee72f37.6dc038","name":"a","rules":[{"t":"set","p":"payload","pt":"msg","to":"a","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":436.1584892272949,"y":354.50115966796875,"wires":[["76744a8c.06f7d4","3ce28ff9.7cf48"]]},{"id":"c9824fb0.8e724","type":"change","z":"eee72f37.6dc038","name":"b","rules":[{"t":"set","p":"payload","pt":"msg","to":"b","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":425.76565170288086,"y":392.1719055175781,"wires":[["76744a8c.06f7d4","3ce28ff9.7cf48"]]},{"id":"4579c55b.5793ec","type":"change","z":"eee72f37.6dc038","name":"c","rules":[{"t":"set","p":"payload","pt":"msg","to":"c","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":419.86888885498047,"y":446.2355887889862,"wires":[["76744a8c.06f7d4","8e13c8c.49f9838"]]},{"id":"18da1e1b.52a292","type":"switch","z":"eee72f37.6dc038","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":261.765625,"y":461,"wires":[["c9824fb0.8e724"]]},{"id":"745d4ea2.4ba37","type":"switch","z":"eee72f37.6dc038","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":270.765625,"y":516,"wires":[["4579c55b.5793ec"]]},{"id":"76744a8c.06f7d4","type":"join","z":"eee72f37.6dc038","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":646.26171875,"y":332.4225311279297,"wires":[["c26f5063.b1eec","9b19e5c5.80ec98","dec9f5f3.9420c8"]]},{"id":"c26f5063.b1eec","type":"change","z":"eee72f37.6dc038","name":"Backward","rules":[{"t":"change","p":"payload","pt":"msg","from":"abc","fromt":"str","to":"Backward","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"bca","fromt":"str","to":"Backward","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"cab","fromt":"str","to":"Backward","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":833.0039291381836,"y":335.9180517196655,"wires":[["a129e3.cc78b62"]]},{"id":"9b19e5c5.80ec98","type":"change","z":"eee72f37.6dc038","name":"Foward","rules":[{"t":"change","p":"payload","pt":"msg","from":"acb","fromt":"str","to":"Forward","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"bac","fromt":"str","to":"Forward","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"cba","fromt":"str","to":"Forward ","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":852.5792770385742,"y":472.85054111480713,"wires":[["cb38ae21.c45cb"]]},{"id":"cb38ae21.c45cb","type":"switch","z":"eee72f37.6dc038","name":"Forward","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Forward","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":945.583122253418,"y":433.0090024471283,"wires":[["713a875f.abe968"]]},{"id":"a129e3.cc78b62","type":"switch","z":"eee72f37.6dc038","name":"Backward","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Backward","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":954.3013877868652,"y":374.2857427597046,"wires":[["713a875f.abe968"]]},{"id":"713a875f.abe968","type":"ui_text","z":"eee72f37.6dc038","group":"df423369.1e76","order":6,"width":"4","height":"1","name":"","label":"Last Pedal Direction:","format":"{{msg.payload}}","layout":"row-spread","x":1156.76171875,"y":467.640625,"wires":[]},{"id":"3ce28ff9.7cf48","type":"trigger","z":"eee72f37.6dc038","op1":"","op2":"b","op1type":"nul","op2type":"str","duration":"500","extend":false,"units":"ms","reset":"a","bytopic":"all","name":"","x":636.2578277587891,"y":408.47271728515625,"wires":[["48fc2b52.6cde24"]]},{"id":"48fc2b52.6cde24","type":"change","z":"eee72f37.6dc038","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"b","fromt":"str","to":"Mounting/Dsmnt","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":776.5078125,"y":513.67578125,"wires":[["713a875f.abe968"]]},{"id":"8e13c8c.49f9838","type":"change","z":"eee72f37.6dc038","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"a","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510.51171875,"y":535.66796875,"wires":[["3ce28ff9.7cf48"]]},{"id":"df423369.1e76","type":"ui_group","z":"","name":"DAudio","tab":"b12ebccc.218e98","disp":false,"width":"8","collapse":false},{"id":"b12ebccc.218e98","type":"ui_tab","z":"","name":"Mountain Bike Computer","icon":"dashboard","disabled":false,"hidden":false}]