Hi, I'm reading analog sensor with the Arduino Node, the which one that use firmware, so it reads really fast, I was trying to use the delay node but it seems that ignore the delay, and also I try to modify the firmware code on the Arduino IDE also no change, someone could help me?
When you say you tried to use the delay node what were you trying to use it for? If you want to only let one message through every so often (which I suspect may be what you want) then you want it in Rate Limit mode (as that is what you want to do) and Drop Intermediate Messages (otherwise it will queue them up).
Actually I already try to use Rate Limit, but I will show you what happend, just let me record the screen.
so basically, it looks like is accumulating on the rate node all the values that is reading, and if you see the dashboard in reading so fast it looks like it reads 100 times in a sec.
I can't read the flow very well but Values does seem to be changing once per second, and you don't seem to have a Delay node on Values2
[{"id":"edb614cf.020e88","type":"arduino in","z":"9171c016.29999","name":"Mega","pin":"0","state":"ANALOG","arduino":"d70d24c3.546d58","x":210,"y":320,"wires":[["e68ecae.0cb5c38"]]},{"id":"c9acd3c5.9d70e","type":"ui_text","z":"9171c016.29999","group":"67ceb806.ee4028","order":4,"width":0,"height":0,"name":"","label":"Vaues","format":"{{msg.payload}}","layout":"row-spread","x":370,"y":400,"wires":[]},{"id":"5710aee6.bde6f","type":"arduino in","z":"9171c016.29999","name":"Mega","pin":"2","state":"ANALOG","arduino":"d70d24c3.546d58","x":530,"y":320,"wires":[["d43dc895.2fb828"]]},{"id":"d43dc895.2fb828","type":"ui_text","z":"9171c016.29999","group":"67ceb806.ee4028","order":4,"width":0,"height":0,"name":"","label":"values 2","format":"{{msg.payload}}","layout":"row-spread","x":740,"y":280,"wires":[]},{"id":"e68ecae.0cb5c38","type":"delay","z":"9171c016.29999","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":360,"y":320,"wires":[["c9acd3c5.9d70e"]]},{"id":"d70d24c3.546d58","type":"arduino-board","z":"","device":"/dev/ttyACM0"},{"id":"67ceb806.ee4028","type":"ui_group","z":"","name":"control valvula","tab":"5dcfacf2.ebe1e4","order":1,"disp":true,"width":"6","collapse":false},{"id":"5dcfacf2.ebe1e4","type":"ui_tab","z":"","name":"Home 1","icon":"dashboard","disabled":false,"hidden":false}]
here is the flow, yeah I don't use the delay node to show you how quick are the readings with out the node, and no it don't change once per second even if I disconect the arduino it keeps showing data that's why I thing that is acummulating and then is sending the data acuummulated
Look back at how I said to configure the delay node, then look at how you have configured it.
Alright thanks I think is working. I did't see the option. Can you help me with the MQTT nodes?.
Well I thing isn't conecting because the broker but I did the installation as always but i need to type on my Raspberry Mosquitto -v to work, some advice?
can you help me with this also
output_value = map(output_value,500,0,0,250);
I want to use that function but I don't know to much Javascript, I wass looking for that function in Javascript
Back on the issue with the delay node, you would be much better to work out how to slow it down in the Arduino, there is no point wasting processor time in node-red handling messages coming in at a much faster rate than is required. This isn't the best place to ask about Arduino code of course.
On the other issues it is best to start new threads so someone who knows about the particular area will see it. Also best to open one thread per issue. If you ask multiple questions on one thread it just gets confusing. Finally make sure you explain the problems you are seeing as clearly as possible.
Isn't that using Firmata? If so, you don't get any control on the Arduino as far as I know. You send something and you get something back immediately.
Yeah is using Firmata, thanks for the information.
So does that mean that for the Arduino to send a value node-red has to ask for it first? If so then the solution to the problem of how to slow down the rate messages are received at is to slow down how often you are asking for it.
Hi @colin - no the arduino node just turns on analogue read mode and the values are streamed in - and we output them if they change... obviously for digital inputs 0 -> 1 and 1 -> 0 is fairly well... binary... so often not high rate - but analogue will often vary a lot due to noise, natural variability, etc etc so a high output rate is expected - that indeed then should be downsampled / smoothed / filtered as appropriate.
OK, understood. So @lalo the Rate Limit delay node is a good way to go.
Thanks to both. Is working well my flow
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.