bodyinteraction 2 - ESP8266 IOT sex toy

This flow controls a ESP8266 WeMos module for a sex toy (vibrator). You can select different modes (e.g. motion controlled vibration speed, maximum speed, sinus curve vibration). The motion and the speed is displayed as a gauge and in a chart.

bodyinteraction.org is an open source project for 3d printing of sex toys and electronics for wireless control of sex toys.

alt text

body interaction 2 is based on the ESP8266 and intends to faciliate a internet of sex toys. You can build and customize your toy using the WeMos modules. In addition there is the bodyintercation 1 vibrator development board which uses the ATtiny84 and RFM12b module. This module is already available at Tindie, but not able to connect to the internet.

The code for bodyinteraction 1 and 2 is developed using the Arduino IDE.

More information: www.bodyinteraction.org

[{"id":"e393790a.6f18d8","type":"tab","label":"Flow 1"},{"id":"fc66cd5f.6acc2","type":"mqtt-broker","z":"e393790a.6f18d8","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":null,"willPayload":"","birthTopic":"","birthQos":"0","birthRetain":null,"birthPayload":""},{"id":"8be741b8.e00bb","type":"ui_group","z":"","name":"Motor","tab":"a1e92375.61f52","order":null,"disp":true,"width":"6"},{"id":"c1db988b.c93628","type":"ui_group","z":"","name":"Data","tab":"a1e92375.61f52","order":2,"disp":true,"width":"6"},{"id":"afb930e9.514c6","type":"ui_group","z":"","name":"Status","tab":"a1e92375.61f52","order":3,"disp":true,"width":"6"},{"id":"1b54ec5b.b8a304","type":"ui_group","z":"","name":"Controls","tab":"a1e92375.61f52","order":4,"disp":true,"width":"6"},{"id":"a1e92375.61f52","type":"ui_tab","z":"","name":"Body Interaction 2 demonstrator","icon":"dashboard","order":0},{"id":"2abe75f6.e1475a","type":"MySQLdatabase","z":"","host":"127.0.0.1","port":"3306","db":"world","tz":""},{"id":"fb68ad7.45e6e5","type":"mqtt-broker","z":"","broker":"m12.cloudmqtt.com","port":"15376","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"e081ddd8.fa94","type":"mqtt out","z":"e393790a.6f18d8","name":"message to BInode","topic":"","qos":"","retain":"","broker":"fb68ad7.45e6e5","x":780.5000152587891,"y":395.3999481201172,"wires":[]},{"id":"6cb850aa.7a679","type":"json","z":"e393790a.6f18d8","name":"parse message","x":172.00001525878906,"y":710.2000061035156,"wires":[["34f6498e.6718e6","f3fca1cb.d4c15","a6ed75d0.467d68","2db6afe1.e2a97","5686ad6a.f52fb4","65b864fb.78025c","52b94842.c3d4c8"]]},{"id":"4a0dce8a.45b05","type":"mqtt in","z":"e393790a.6f18d8","name":"wemos mini bi","topic":"BIcomm","qos":"2","broker":"fb68ad7.45e6e5","x":120,"y":598.2000061035156,"wires":[["6cb850aa.7a679"]]},{"id":"8e289062.0c2dd","type":"ui_gauge","z":"e393790a.6f18d8","name":"Motor speed","group":"8be741b8.e00bb","order":1,"width":0,"height":0,"gtype":"gage","title":"Motor speed","label":"units","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"x":718.5000152587891,"y":568.7999435424805,"wires":[]},{"id":"2db6afe1.e2a97","type":"function","z":"e393790a.6f18d8","name":"get message number","func":"var value;\nvalue=msg[\"payload\"][\"messageNumber\"];\nmsg.payload=value;\nreturn msg;","outputs":1,"noerr":0,"x":404.49998474121094,"y":757.4000106811524,"wires":[["5f90737.cc4608c"]]},{"id":"34f6498e.6718e6","type":"function","z":"e393790a.6f18d8","name":"get motor speed","func":"var value;\nvalue=msg[\"payload\"][\"motor1speed\"];\nmsg.payload=value;\nreturn msg;","outputs":1,"noerr":0,"x":386.4999542236328,"y":597.9999862670899,"wires":[["8e289062.0c2dd","5336f2d2.43c9ac","76ccabe2.09e364"]]},{"id":"f3fca1cb.d4c15","type":"function","z":"e393790a.6f18d8","name":"get accelerometer speed","func":"var value;\nvalue=msg[\"payload\"][\"fusionedData\"];\nmsg.payload=value;\nreturn msg;","outputs":1,"noerr":0,"x":415.4999542236328,"y":648.4000106811524,"wires":[["6e697866.5748d8","a52c0694.b33eb8"]]},{"id":"6e697866.5748d8","type":"ui_gauge","z":"e393790a.6f18d8","name":"acceleration","group":"c1db988b.c93628","order":1,"width":0,"height":0,"gtype":"gage","title":"Acceleration","label":"units","format":"{{value}}","min":0,"max":"20000","colors":["#00b500","#e6e600","#ca3838"],"x":717.5000152587891,"y":661.0000473022461,"wires":[]},{"id":"a6ed75d0.467d68","type":"function","z":"e393790a.6f18d8","name":"get motor mode","func":"var value;\nvalue=msg[\"payload\"][\"motor1mode\"];\nif (value==0) msg.payload=\"off\";\nif (value==1) msg.payload=\"max speed\";\nif (value==2) msg.payload=\"sinus\";\nif (value==3) msg.payload=\"motion\";\nif (value==4) msg.payload=\"constant\";\nif (value==5) msg.payload=\"listen\";\nif (value==6) msg.payload=\"listen&motion\";\nreturn msg;","outputs":1,"noerr":0,"x":384.4999542236328,"y":701.4000106811524,"wires":[["ea69c39f.50602"]]},{"id":"ea69c39f.50602","type":"ui_text","z":"e393790a.6f18d8","group":"8be741b8.e00bb","order":3,"width":0,"height":0,"name":"motor mode","label":"Mode","format":"{{msg.payload}}","layout":"row-center","x":718.5000152587891,"y":754.4000106811524,"wires":[]},{"id":"5686ad6a.f52fb4","type":"function","z":"e393790a.6f18d8","name":"get LED status","func":"var value;\nvalue=msg[\"payload\"][\"LEDstatus\"];\nif (value==0) msg.payload=\"off\";\nif (value==1) msg.payload=\"on\";\nreturn msg;","outputs":1,"noerr":0,"x":385.4999542236328,"y":815.1999984741211,"wires":[["f1ffef94.34577"]]},{"id":"5f90737.cc4608c","type":"ui_text","z":"e393790a.6f18d8","group":"afb930e9.514c6","order":2,"width":0,"height":0,"name":"message number","label":"Message number","format":"{{msg.payload}}","layout":"row-center","x":736.5000152587891,"y":805.4000106811524,"wires":[]},{"id":"f1ffef94.34577","type":"ui_text","z":"e393790a.6f18d8","group":"afb930e9.514c6","order":1,"width":0,"height":0,"name":"LED status","label":"LED","format":"{{msg.payload}}","layout":"row-center","x":718.5000152587891,"y":855.4000106811524,"wires":[]},{"id":"5336f2d2.43c9ac","type":"ui_chart","z":"e393790a.6f18d8","name":"Motor speed","group":"8be741b8.e00bb","order":2,"width":0,"height":0,"label":"Speed","chartType":"line","legend":"false","xformat":"%H:%M:%S","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":"10","removeOlderUnit":"60","x":717.5000152587891,"y":609.5999618530274,"wires":[[],[]]},{"id":"a52c0694.b33eb8","type":"ui_chart","z":"e393790a.6f18d8","name":"acceleration chart","group":"c1db988b.c93628","order":2,"width":0,"height":0,"label":"Acceleration","chartType":"line","legend":"false","xformat":"%H:%M:%S","interpolate":"linear","nodata":"","ymin":"","ymax":"","removeOlder":"5","removeOlderUnit":"60","x":735.5000152587891,"y":704.5999618530274,"wires":[[],[]]},{"id":"5c18ebeb.80d524","type":"ui_switch","z":"e393790a.6f18d8","name":"LED switch","label":"LED on / off","group":"1b54ec5b.b8a304","order":1,"width":0,"height":0,"passthru":false,"topic":"BIcomm","style":"","onvalue":" {messageType : \"execute\",  actuator : \"LED\",  actuatorValue : 1 }","onvalueType":"str","onicon":"","oncolor":"","offvalue":" {messageType : \"execute\",  actuator : \"LED\",  actuatorValue : 0 }","offvalueType":"str","officon":"","offcolor":"","x":598.5000152587891,"y":207.40003204345703,"wires":[["e081ddd8.fa94"]]},{"id":"373216fc.74ff6a","type":"ui_button","z":"e393790a.6f18d8","name":"set motor off button","group":"1b54ec5b.b8a304","order":2,"width":0,"height":0,"label":"motor off","color":"","bgcolor":"","icon":"","payload":"{  messageType : \"execute\",  actuator : \"motor1\",  actuatorMode: \"off\"  }","payloadType":"str","topic":"BIcomm","x":191.4999542236328,"y":179.99996185302734,"wires":[["e081ddd8.fa94"]]},{"id":"8b11c396.0eb93","type":"ui_button","z":"e393790a.6f18d8","name":"set motor to sinus mode","group":"1b54ec5b.b8a304","order":4,"width":0,"height":0,"label":"sinus mode","color":"","bgcolor":"","icon":"","payload":"{  messageType : \"execute\",  actuator : \"motor1\",  actuatorMode : \"sinus\"  }","payloadType":"str","topic":"BIcomm","x":212.49998474121094,"y":334.00000915527346,"wires":[["e081ddd8.fa94"]]},{"id":"d321acfb.b985c","type":"ui_button","z":"e393790a.6f18d8","name":"set motor modus to motion controlled","group":"1b54ec5b.b8a304","order":5,"width":0,"height":0,"label":"motion controlled","color":"","bgcolor":"","icon":"","payload":"{  messageType : \"execute\",  actuator : \"motor1\",  actuatorMode : \"motion\"  }","payloadType":"str","topic":"BIcomm","x":254.50006103515625,"y":384.0000396728516,"wires":[["e081ddd8.fa94"]]},{"id":"5d8daa4a.c96f84","type":"ui_button","z":"e393790a.6f18d8","name":"set motor mode to max speed","group":"1b54ec5b.b8a304","order":3,"width":0,"height":0,"label":"maximum speed","color":"","bgcolor":"","icon":"","payload":"{  messageType : \"execute\",  actuator : \"motor1\",  actuatorMode : \"max\" }","payloadType":"str","topic":"BIcomm","x":234.49998474121094,"y":434.0000701904297,"wires":[["e081ddd8.fa94"]]},{"id":"e25e5ecd.97cfb","type":"function","z":"e393790a.6f18d8","name":"construct command in JSON","func":"msg.payload={messageType:\"execute\", actuator:\"motor1\",actuatorMode:\"constant\",actuatorValue:msg.payload}\nmsg.topic = \"BIinTopic\";\nreturn msg;","outputs":1,"noerr":0,"x":462.49998474121094,"y":485.20000610351565,"wires":[["e081ddd8.fa94"]]},{"id":"76ccabe2.09e364","type":"ui_slider","z":"e393790a.6f18d8","name":"Set motor speed","label":"Speed","group":"1b54ec5b.b8a304","order":8,"width":0,"height":0,"passthru":false,"topic":"BIcomm","min":"10","max":"100","step":"10","x":183.69996643066406,"y":486.20000610351565,"wires":[["e25e5ecd.97cfb"]]},{"id":"186ca52a.86215b","type":"ui_button","z":"e393790a.6f18d8","name":"set motor to listen and motion mode","group":"1b54ec5b.b8a304","order":7,"width":0,"height":0,"label":"listen and motion mode","color":"","bgcolor":"","icon":"","payload":"{  messageType : \"execute\",  actuator : \"motor1\",  actuatorMode: \"listenmotion\"  }","payloadType":"str","topic":"BIcomm","x":241.16665649414062,"y":282.2666702270508,"wires":[["e081ddd8.fa94"]]},{"id":"fab01a3c.f69ff8","type":"ui_button","z":"e393790a.6f18d8","name":"set motor to listen mode","group":"1b54ec5b.b8a304","order":6,"width":0,"height":0,"label":"listen mode","color":"","bgcolor":"","icon":"","payload":"{  messageType : \"execute\",  actuator : \"motor1\",  actuatorMode: \"listen\"  }","payloadType":"str","topic":"BIcomm","x":209.16665649414062,"y":232.26667022705078,"wires":[["e081ddd8.fa94"]]},{"id":"1af808cc.d34977","type":"ui_text","z":"e393790a.6f18d8","group":"1b54ec5b.b8a304","order":0,"width":0,"height":0,"name":"","label":"Name","format":"{{msg.payload}}","layout":"row-spread","x":701.1667785644531,"y":911.3333435058594,"wires":[]},{"id":"2172848c.c8035c","type":"ui_text","z":"e393790a.6f18d8","group":"1b54ec5b.b8a304","order":0,"width":0,"height":0,"name":"","label":"Mac","format":"{{msg.payload}}","layout":"row-spread","x":705.1667175292969,"y":961.0000178019206,"wires":[]},{"id":"65b864fb.78025c","type":"function","z":"e393790a.6f18d8","name":"get Name of ESP device","func":"var value;\nvalue=msg[\"payload\"][\"deviceName\"];\nmsg.payload=value;\nreturn msg;","outputs":1,"noerr":0,"x":417.16668701171875,"y":875.9333531697591,"wires":[["1af808cc.d34977"]]},{"id":"52b94842.c3d4c8","type":"function","z":"e393790a.6f18d8","name":"get ESP's chip ID","func":"var value;\nvalue=msg[\"payload\"][\"chipId\"];\nmsg.payload=value;\nreturn msg;","outputs":1,"noerr":0,"x":397.16668701171875,"y":944.9333836873373,"wires":[["2172848c.c8035c"]]}]

Flow Info

Created 7 years, 3 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • function (x8)
  • json (x1)
  • mqtt in (x1)
  • mqtt out (x1)
  • mqtt-broker (x2)
Other
  • MySQLdatabase (x1)
  • tab (x1)
  • ui_button (x6)
  • ui_chart (x2)
  • ui_gauge (x2)
  • ui_group (x4)
  • ui_slider (x1)
  • ui_switch (x1)
  • ui_tab (x1)
  • ui_text (x5)

Tags

  • vibrator
  • sex
  • toy
  • ESP8266
  • 3dprinting
  • molding
  • Arduino
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option