# Tag Info

8

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. Ohm's Law defines the relationship between Voltage (V), Current (I) and Resistance (R). R = V/I To find one unknown value (in your case R) you need to know ...

6

Since you already know how to hook up a pot and read it's value, it's quite simple. You already have it hooked up in a voltage divider configuration and are getting a 10 bit (0-1023) value using analogRead(), you just need to decide what to do with it. Assume potVal has the value of the pot.; if (potVal < 256) { // Pot is one quarter turn or less } ...

5

A0 input is high impedance, so very little current is flowing into A0. The value is so small that you can simplify that it flows only from +5V through the potentiometer to GND. For some applications, when you are measuring high-impedance sources (a source that can deliver very little current) this simplification may not be correct. You can find more ...

5

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 numbers will (should!) never be negative, there's a flavour of int called unsigned int. By using that: unsigned int val = analogRead(...); you can cover a range ...

5

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 output of the pot will be at half the voltage of the input. If it is turned all the way then the output will equal the input voltage and if it is not turned at ...

4

Ah, now I see. Your confusion in this case is perfectly understandable. They threw a couple of capacitors into the circuit without explaining why they were added in the first place. In order to understand why capacitors were added you need to go a little deeper into electronics theory, specifically capacitance and inductance, what they are and how they work. ...

4

You know how wide the display is. You know how wide the text is. You know the position of the potentiometer. With those you can determine where in the text (if the text is wider) or display (if the display is wider) you need to start drawing from and where you need to stop drawing. Subtracting the text width from the display width will give you the range for ...

4

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 the power and ground to the potentiometers. Note that both sides of the pot need to be controlled, not just one, since any connection of one will interfere with ...

4

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 charge the sample/hold capacitor. However your potentiometer would not vary rapidly (certainly not in the order of thousands of herz). Thus I don't think the ...

4

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 Blink Without Delay Arduino tutorial.

4

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.

4

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 where Rx is the resistance you want to measure and Rb is a known bias resistance. The only unknown is the choice of the bias resistance. The simple rule of thumb ...

4

You can likely user 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 reason you might wish to do so would to be able to stop the device from draining power while the entire system is in a low-power sleep mode, or to otherwise disable it ...

4

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 number. If K1 is not equal to 0, the inner part of that if statement can never be reached. What you meant to do was "if the voltage at the pin K1 is low". For ...

4

You need to use Serial.print instead of Serial.write.

3

I made this video and github just for this about a year ago. And here is the code: /* 2-axis joystick connected to an Arduino Micro to output 4 pins, up, down, left & right If you are using pull down resistors, change all the HIGHs to LOWs and LOWs to HIGH. This skectch is using pull up resistors. */ int UD = 0; int LR = 0; /* Arduino Micro output ...

3

All the relay boards I've come across are 'active low' i.e. as you've discovered bringing the control pin down to earth activates the relay. As an aside just be careful that the arduino has enough juice to power the relays, a separate supply is normally required if these are coil rather than ssr type relays

3

Adding to Ricardo's answer: PWM can do the job, sort of. You need a low pass filter (LPF) to convert the PWM to an analog voltage and an amplifier to take it from 0-5 to 0-10V. Or you can get a dedicated digital-to-analog (DAC) chip but that will obviously be more expensive than a resistor and capacitor for the LPF. Here's some tutorials on converting your ...

3

No, it would not be correct to use a single resistor to replace a potentiometer. On an LCD the potentiometer is used to adjust the bias level of the LCD - that is the contrast. You need to use it to set a voltage between Vcc and Vee, which you feed into Vo. That is, a voltage somewhere between +5V and -5V. You can't do that with one resistor. You can, ...

3

Digital potentiometers are not a good choice for controlling the speed of a motor. They are designed only for very low current applications - things like setting offset points for op-amps and things like that - things where you would use a small trimmer pot rather than a large power rheostat. Instead you should be controlling the motor using PWM and a ...

3

Assuming A0 is set to input then it is a high-impedance input. That is, the input has a high resistance, and only consumes enough current to "sample" the voltage.

3

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 of my Arduino Uno are outputting 2 volts?”, such an input will read high when the switch is closed, and will read randomly when it is open, because an input ...

3

Avoid delay. Very simplistic alternative: unsigned long lastLedToggleTime; unsigned long currentLedToggleInterval; void loop() { ... unsigned long now = millis(); if ( (now - lastLedToggleTime) > currentLedToggleInterval) { lastLedToggleTime = now; // We need to toggle the LED now. if ( digitalRead( ledPin ) == LOW ) { // LED ...

3

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 counterparts. That does not mean though you cannot control higher voltage circuits, just not directly. Actually if anything above 6V is connected to an Arduino ...

3

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 feeding of LEDs So I am assuming that the digital pins in arduino are positive (are they 5v?). Yes and yes (assuming a 5V Arduino). So why cant the pot be ...

3

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 resistance to compare with the wiring resistance? 3. How much filtering do you need? 4. What kind of linearization do you want to apply? A lower value thermistor ...

3

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 strip one presses. When no pressure is applied, the middle pin floats, so be sure to use some sort of weak pullup, such as 100K ohm. To use Connect one side pin to ...

3

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

3

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 use, as long as it's "around" the 10kΩ mark (100kΩ should be fine, 50kΩ, 1kΩ etc - anything below 1kΩ may not work) - what matters is the ratio of the values of ...

Only top voted, non community-wiki answers of a minimum length are eligible