2020年12月25日 星期五

Node-Red DS1820 & Servo Motor

   Node-Red DS1820 & Servo Motor


Node-Red程式1



[{"id":"fcedd20e.08ac6","type":"mqtt out","z":"cb74fe7b.b6c12","name":"","topic":"alex9ufo/inTopic/servo","qos":"1","retain":"false","broker":"e4d9b72d.d14398","x":640,"y":140,"wires":[]},{"id":"a10598db.465ae8","type":"ui_button","z":"cb74fe7b.b6c12","name":"","group":"309b9c97.50a4c4","order":1,"width":0,"height":0,"label":"Min  0%","color":"black","icon":"","payload":"0","payloadType":"num","topic":"","x":217.00003051757812,"y":141.66653442382812,"wires":[["4af995b4.bbdc1c"]]},{"id":"694c6869.decc58","type":"ui_slider","z":"cb74fe7b.b6c12","name":"","label":"Servo","group":"309b9c97.50a4c4","order":4,"width":0,"height":0,"passthru":true,"topic":"","min":0,"max":"100","step":1,"x":214.00003051757812,"y":289.66650390625,"wires":[["4af995b4.bbdc1c"]]},{"id":"bd4806ea.45dcb8","type":"ui_gauge","z":"cb74fe7b.b6c12","name":"","group":"309b9c97.50a4c4","order":5,"width":0,"height":0,"gtype":"donut","title":"Servo position ","label":"position ","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"x":600,"y":200,"wires":[]},{"id":"2db2b1f4.3fb7fe","type":"ui_button","z":"cb74fe7b.b6c12","name":"","group":"309b9c97.50a4c4","order":3,"width":0,"height":0,"label":"Max 100%","color":"black","icon":"","payload":"100","payloadType":"num","topic":"","x":219.00003051757812,"y":230.33319091796875,"wires":[["4af995b4.bbdc1c"]]},{"id":"4af995b4.bbdc1c","type":"function","z":"cb74fe7b.b6c12","name":"node","func":"\nreturn msg;","outputs":1,"noerr":0,"x":405.00006103515625,"y":175.33316040039062,"wires":[["fcedd20e.08ac6","bd4806ea.45dcb8","ce6c6d8.4ebb79"]]},{"id":"ce6c6d8.4ebb79","type":"link out","z":"cb74fe7b.b6c12","name":"slider","links":["192588bf.5ccc17"],"x":561,"y":291.3331298828125,"wires":[]},{"id":"192588bf.5ccc17","type":"link in","z":"cb74fe7b.b6c12","name":"","links":["ce6c6d8.4ebb79"],"x":295,"y":340,"wires":[["694c6869.decc58"]]},{"id":"fabe3fdf.00386","type":"ui_button","z":"cb74fe7b.b6c12","name":"","group":"309b9c97.50a4c4","order":2,"width":0,"height":0,"passthru":false,"label":"50%","tooltip":"","color":"black","bgcolor":"","icon":"","payload":"50","payloadType":"num","topic":"","x":208.00003051757812,"y":183.66650390625,"wires":[["4af995b4.bbdc1c"]]},{"id":"ef26e619.8b1a28","type":"comment","z":"cb74fe7b.b6c12","name":"ESP8266 MQTT Control Servo","info":"","x":282.0000305175781,"y":70.66650390625,"wires":[]},{"id":"e4d9b72d.d14398","type":"mqtt-broker","name":"","broker":"broker.mqtt-dashboard.com","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"309b9c97.50a4c4","type":"ui_group","name":"Servo Control","tab":"e0a394f8.695aa8","order":2,"disp":true,"width":"6"},{"id":"e0a394f8.695aa8","type":"ui_tab","name":"ESP8266","icon":"dashboard","order":2}]

Node-Red程式2



[{"id":"7e25c2d5.f0476c","type":"comment","z":"4e792ace.0c0c04","name":"ESP8266 MQTT Temperature DS18B20 ","info":"","x":310,"y":40,"wires":[]},{"id":"866663df.03348","type":"mqtt in","z":"4e792ace.0c0c04","name":"DS1820 Temp Sensor","topic":"alex9ufo/outTopic/temp/DS1820sensor","qos":"2","datatype":"auto","broker":"e4d9b72d.d14398","x":260,"y":160,"wires":[["cce3ab83.b54588","73fc7aab.c2cd94","559ff7f.63d5408","59fa23b0.f46e5c"]]},{"id":"cce3ab83.b54588","type":"debug","z":"4e792ace.0c0c04","name":"","active":true,"console":"false","complete":"payload","x":530,"y":100,"wires":[]},{"id":"73fc7aab.c2cd94","type":"ui_gauge","z":"4e792ace.0c0c04","name":"","group":"4e2af753.086688","order":2,"width":0,"height":0,"gtype":"gage","title":"Temperature","label":"ºC","format":"{{value}}","min":"10","max":"50","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":530,"y":160,"wires":[]},{"id":"559ff7f.63d5408","type":"ui_chart","z":"4e792ace.0c0c04","name":"5  Min","group":"4e2af753.086688","order":0,"width":0,"height":0,"label":"5  Min","chartType":"line","legend":"false","xformat":"H:M:S","interpolate":"linear","nodata":"5  Min","dot":false,"ymin":"10","ymax":"50","removeOlder":"1","removeOlderPoints":"","removeOlderUnit":"60","cutout":"","useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":510,"y":220,"wires":[[]]},{"id":"59fa23b0.f46e5c","type":"ui_chart","z":"4e792ace.0c0c04","name":"1  Hour","group":"4e2af753.086688","order":0,"width":0,"height":0,"label":"1  Hour","chartType":"line","legend":"false","xformat":"H:M:S","interpolate":"linear","nodata":"","dot":false,"ymin":"10","ymax":"50","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":"","useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":510,"y":280,"wires":[[]]},{"id":"28b0dd1b.b3d632","type":"function","z":"4e792ace.0c0c04","name":"","func":"var max=50;\nvar min=10;\nmsg.payload= Math.floor(Math.random()*(max-min+1))+min;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":310,"y":380,"wires":[["beb35e5b.181b6"]]},{"id":"beb35e5b.181b6","type":"mqtt out","z":"4e792ace.0c0c04","name":"DS1820 Temp Sensor","topic":"alex9ufo/outTopic/temp/DS1820sensor","qos":"2","retain":"","broker":"e4d9b72d.d14398","x":520,"y":380,"wires":[]},{"id":"69aed158.bec98","type":"inject","z":"4e792ace.0c0c04","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"4","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":380,"wires":[["28b0dd1b.b3d632"]]},{"id":"e4d9b72d.d14398","type":"mqtt-broker","name":"","broker":"broker.mqtt-dashboard.com","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"4e2af753.086688","type":"ui_group","name":"ESP8266 DS18B20 MQTT","tab":"e0a394f8.695aa8","order":1,"disp":true,"width":"6"},{"id":"e0a394f8.695aa8","type":"ui_tab","name":"ESP8266","icon":"dashboard","order":2}]

沒有留言:

張貼留言

Messaging API作為替代方案

  LINE超好用功能要沒了!LINE Notify明年3月底終止服務,有什麼替代方案? LINE Notify將於2025年3月31日結束服務,官方建議改用Messaging API作為替代方案。 //CHANNEL_ACCESS_TOKEN = 'Messaging ...