Arduino Nano Every with Firmata

Hi guys.
I´m using a Nano Every connected by USB to Raspberry Pi.
Digital outputs and analogue output are working since months, but now I need a digital input who´s fluctuating.
I´ve tried the node setting "digital input" with external resistor as pullup and pulldown and also "digital input with pullup". But my input is always fluctuating between "0" and "1" or showing always "1" when input is "0"
What´s my fault ?

With kind regards,

I'm confused.

Node-red is running on the Raspberry Pi and this is an ARDUINO....

Ok, you said it was connected by USB.

So: maybe start by showing us what the arduino is sending to you.

How fast is this fluctuation?
And maybe more so: WHY is it fluctuating?

Oh, sorry, yes, NR is running on a Pi and Nano is connected to the Pi by USB.
I'm using a microswitch between 5V and D12.
When switch is closed I'm having 5V on D12.
But in NR the debug node is jumping between 1 and 0.
When the input is low, debug node still shows 1.
The fluctuation is frequently every second.

Then I would suggest you look at the code on the Arduino and make sure it is working correctly.


Hang on......

So is D12 being pull low?
Do you have a resistor in the circuit with the micro switch? If not, you have probably fried D12 as an input.

You don't understand.
Firmata is a protocol for communicating between an Arduino and the host computer, providing direct access to the IO pins.
There's no code on the Arduino.
The node gives to options and both are not working.

Ok, I didn't understand that bit.

How about this bit:
Do you have a resistor in the circuit with the micro switch? If not, you have probably fried D12 as an input.

I've tried 10k as pullup and pulldown, still fluctuations.

Ok, you have TRIED 10k pull up and pull down.

Here's my understanding of what you are seeing/getting:

You want D12 as a digital input. Fair enough.

The input signal is a high and you have used an external 10k resistor to pull down so at normal the input (D12) is low.

When reading the input you are getting unstable output from the arduino.


So if you remove the microswitch's wire and leave ONLY the 10k pull down what do you get?

That is: The ONLY THING going to D12 is the pull down resistor.

By the way:
How does firmata tell the arduino that that pin is a digital input?

That is confusing.

If your input signal is a HIGH then you would want it it "digital input with pulldown".


If you did that, AND you connected +5 (no resistor) to the input when the microswitch is active
you may have damaged that pin.

I am not sure what the convention is for direct +5 / 0 inputs to pins if internal pullup/down is used.

Without connected switch and a pulldown resistor the debug node shows 0.
With connected switch and a pulldown resistor the debug node shows 0.
With closed switch the value is fluctuating between 0 and 1.

I don't know the firmware code, but I think by choosing the options in that node you're telling the Arduino that the pin is an input or output.

You can choose between "digital input" , "digital input with pulldown" , "analogue input" and "string".

Then I would have a serious look at the switch.

(With an oscilloscope even)

Better idea:

Get the micro switch, resistor and LED.

+5v, resistor, LED, micro switch, -

At normal the LED should be off.

Press micro switch. LED ON - SOLID.

If it blinks, you know where the problem is.

UPDATE - another suggestion

Forget the micro switch for now.
Get a small piece of wire and put one end on +5v and touch the other on D12. Sorry: CONNECT, not touch.

Leave it connected.

What do you see/get in/on node-red?

Ok, this morning the input was HIGH, but cable was not connected.
Only the resistor was connected to GND.
Then I´ve put a wire between D12 and +5V it keeps HIGH, but after release it jumps to LOW.
Now, everytime when the D12 is HIGH or LOW it shows HIGH or LOW in Node-Red.
On debug window if HIGH it shows more values in a second.
But also only with a wire sometimes the node shows fluctuations or jumping between 0 and 1 twice or three times.
The same on other inputs and with all microswitches or IR sensors.
Here an example:


Maybe the input needs to be debounced ?

That's a problem there.

If the resistor is connected to GND and the input is showing you HIGH.....

(sorry another late thought)

Get a multi meter and see what it tells you the voltage is on D12 when the resistor is only connected to GND.

If it is a digital one,

Why is the debug showing the topic to be 11 which may mean pin 11 not 12 ?

1 Like

That's a good catch.

Because it was testet with D11.
Fault is an all inputs.

When the node shows "1", but only with connected resistor to GND, I measure 0V.

I think the arduino may be kaput.

But only the inputs ?
Outputs are working fine.

I´m having a second Arduino as reserve.
Will check it in the afternoon

Try a different arduino and see if the problem remains or goes.

That way you can know for sure.

When you have eliminated all the obvious problems, the remaining things - how every strange - could be the answer.

(Bad rework of a famous proverb I think by Arthur Conan Doyle.)

Hi guys.

I´ve exchanged the Arduino and got still the same fault.
Could the code be the reason ? Do I have to configurate the digital input ?
Here´s the code for digital input: