Share Your Experience: Take the 2024 Developer Survey

# Tag Info

### How do you handle sensor drift?

ok, once I got the idea I would need to do it in code, it became simpler to solve. In looking around the terms of quantization, the term thresh-holding came up, and I realized how to solve the problem....
• 892

### A question about resistance measurement with arduino

If you know Ohm's Law (which you should) and you realise that the ADC measures voltage, you should be able to work it out from there. But I will go into minute detail for you to ensure you understand. ...
• 105k

### Why can't I use just the digital pins and a ground to use a potentiometer?

A potentiometer is an analog device, meaning it communicates its position by varying the voltage rather than sending discrete ones and zeros. If a linear potentiometer is turned half way then the ...
• 523
Accepted

### Powering potientiometer/button with a digital pin

You can likely use an I/O pin as an output to "power" fairly high-impedance devices such as pullup resistors for buttons, or even potentiometers of moderate to high total resistance. A ...
• 5,391

### How do you handle sensor drift?

Remove the analog component from your device. Use a rotary encoder. It will sense the knob rotation digitally. One huge advantage is that you can easily select the sensitivity of the input. One click ...
• 1,515
Accepted

### Getting negative results from calculations

analogRead() returns a number from 0 to 1023, and you want to convert that to a range from 0 to 255? One easy way would be to simply divide the reading by 4. On a more general note, given that the ...
• 1,875

### How do you handle sensor drift?

Some methods for "dealing" with the noise: Take multiple samples. Calculate the average ("mean"). Discard the decimal. This is "oversampling" along with resolution ...
• 105k
Accepted

### Multiplexing potentiometers

There are a few ways of doing what you want. One would be to use an analog multiplexer as in this answer: Expanding analog inputs to the Arduino Another would be to use digital I/O pins to control ...
• 105k
Accepted

### Maximum potentiometer resistance

There is a lengthy discussion about this on the Arduino Forum. As I understand it, the input impedance is only important if you are sampling a rapidly varying signal, as it takes a finite time to ...
• 38.3k

### Analog output doesn't work for just 2 LEDs [Arduino Mega]

Analog pins an only read analog values, not write them. analogWrite() is a deceptive name. It should really be PWMWrite() since all it does is PWM. And that, of course, needs PWM pins.
• 105k

### What difference makes resistance of thermistors?

Skip to the end to get the easy answer! Your choice of thermistor and bias resistor values depends on the following: 1. How much current do you want to spend? 2. How do you want the thermistor ...
• 407
Accepted

### Digital selection for gain control not working instead showing 0

pinMode( K1, INPUT ); with if(K1 == LOW && K2 == LOW) makes no sense. K1 is a pin number. LOW is a macro for 0 (HIGH for 1). You are comparing a static pin number against a static ...
• 3,646

You need to use Serial.print instead of Serial.write.
• 11.3k
Accepted

When you reduce the resolution from 10 bits to 7 bits, every possible output corresponds to an interval of inputs. If you add some hysteresis, then those intervals should overlap. Below is a ...
• 43.3k

### Why can't I use just the digital pins and a ground to use a potentiometer?

I had hooked up the positive of led to a digital input of the arduino and negative to the ground of the board. You shouldn't have done that. It damages both the LED and the Arduino. The care and ...
• 38.3k

### Use interrupts with analog pins in arduino or another possible solution?

You are looking for the bad solution for a simple problem. As Ignacio Vazquez-Abrams puts it, the problem is you using delay(). The simplest solution is to manage the timings with millis(). See the ...
• 43.3k
Accepted

### Use interrupts with analog pins in arduino or another possible solution?

Avoid delay. Very simplistic alternative: unsigned long lastLedToggleTime; unsigned long currentLedToggleInterval; void loop() { ... unsigned long now = millis(); if ( (now - ...
• 155

### Wiring a potentiometer to control a 9V battery powering 2 LEDs in series

Yes, Arduino is a 5V microcontroller, meaning it can directly control 5V circuits only. You might incur in problems also trying to deal with 3.3V circuits, even if Arduino is pretty friendly to 3.3V ...
• 1,281
Accepted

### Potentiometer with switch wiring question. Not reading correctly

From your description of switch wiring, it sounds like you have one of the switch leads attached to +5 V and the other switch lead to an input. As noted in comments and answers to “Why all unset pins ...

### What difference makes resistance of thermistors?

The standard way to measure a resistive sensor is to make a voltage divider with the sensor and a fixed resistance between Vcc and GND, like this: Vcc │ Rb │ ├─── analog input │ Rx │ GND ...
• 43.3k
Accepted

### Ribbon sensor resistance slowly drops when released

The Adafruit website says this: There is a nominal 10K resistance across the two outer leads. The middle pin resistance with respect to either of the outer pins changes depending on where on the ...
• 2,559
Accepted

### What is the lowest resistance pot that is useful with an analog input?

Assuming you wired it correctly (ie. you put the wiper to the analog input) your first setup looked like this: Your big problem here is the current flow through the pot. Using Ohms Law the current ...
• 38.3k

write() is a function for binary data. I you want to print the number as text, use print() or println(). Serial.println(potentioVal);
• 18k

### How to regulate a led on-board?

Pin 13, which is the on-board LED, is not a pwm pin. So you cannot Control the brightness of that LED on-board. You will have to use another LED and a PWM pin.
Accepted

### Trying to use an LCD 1602 to display, but I don't have a 10 KOhm potentiometer

Yes. All a potentiometer is, is two resistors end to end. The "wiper" is the join between the two resistors. It doesn't matter too much what value potentiometer (and hence what value resistors) you ...
• 105k
Accepted

### I2C potentiometer mess

The registers are listed in table 4-1. Clearly enough. The command byte format is shown in chapter 6. That command byte includes the operation and the register number, as well as upper bits for ...
• 105k

### PWM Control, How to stop LED from Flickering?

Your code doesn't make much sense. You set the LED to 2 different brightness values that don't have anything to do with each other: The pot brightness and the button-based brightness. You only ...
• 5,702
Accepted

### Arduino UNO - Fluctuation of inputs and outputs

You seem to be experiencing cross-talk between the analog channels. This happens because all the channels are funneled by an analog multiplexer into the same sample-and-hold capacitor. If the source ...
• 43.3k