We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [switch]

In electrical engineering, a switch is an electrical component that can break an electrical circuit, interrupting the current or diverting it from one conductor to another

Filter by
Sorted by
Tagged with
4
votes
1answer
90 views

Can I use an AC signal to make an LED light up with arduino?

I want to use a 220VAC load as a signal and act as a switch to my arduino so Labview could interpret it as an LED ON state. I used a 4n33 octocoupler but it seems that the LED Simulation on labview ...
4
votes
2answers
320 views

Why digital pin not reading ON from push button switches connected to 5V and pull-down 10K resistor?

Here's my circuit: And the code: //pins const int control1 = 2; const int control2 = 3; const int enable = 9; const int pinDirection = 4; const int pinOnOff = 5; const int pot = A0; //states ...
3
votes
1answer
150 views

Switching Many Switches with one Input

I have a situation where I need to select between two signals, lets say 1A or 2B and route it to output 3C. I need to do this six times (2A or 2B to output 2C, 3A or 3B to output 3C, etc.). These all ...
3
votes
1answer
512 views

Choosing the right mosfet to switch on-off a neopixel strip

I,m trying to find the right mosfet or transistor to switch on-off a neopixel strip to safe battery power on a Lipo 3.7v using a pro mini 3.3v. My Animation-Setup and Power Comsumption with 35 ...
2
votes
2answers
2k views

State machine sketch to drive a DC motor with limit switches [closed]

I have a DC motor that will need to use two limit switches to detect end of travel in two directions. I've read that coding a state machine to do this task is the best method, however I have no idea ...
2
votes
1answer
5k views

Button with switch timer and reset time function + LED feedback. What am I doing wrong?

Beginner here. I´ve been trying to implement a button function timer working with millis() instead of delay as I want the button to be responsive while the timer is running. So far I´ve managed to ...
2
votes
3answers
612 views

Is there a cheap relay that can control voltage from stuff like bulb lights with a 5 V control output?

I need to power a light bulb or something like 110 V or 220 V at normal amperage for TV or something at that range like a fan... My micro-controller is an Arduino with 5 V out and 12 V max out trough ...
2
votes
2answers
370 views

Calculate sensor unique address with a 8 position DIP Switch

I have a large amount of sensor boards that I need to be able to configure setting unique addresses. Each sensor is attached to it's own arduino, I'm using a 8 position DIP switch for setting the ...
2
votes
3answers
179 views

Controlling 10+x 5m led strips with 10+ individual analog floor switches

I am looking to control around 10 (exact number TBD) non-addressable 5m led strips with an Arduino. Each led strip will be activated when a corresponding DIY analog floor switch. The idea is to have ...
2
votes
2answers
714 views

Problem using an array inside a switch statement

I am having a problem when using a switch statement to check for something inside an array. I am using an int as my switch, then I compare the character arrays using strstr. So it reads like this: ...
2
votes
1answer
154 views

Is this a good way to filter noise due to vibration in limit switch?

I have a circuit connected as follows my limit switches which are attached to my structure sometimes gets falsely triggered, so I wrote this code to address it. My motor is supposed to go down skip ...
2
votes
2answers
123 views

Write a condition to execute 2 switch-case functions?

I'm new to programming and using Arduino products, and was wondering if someone wouldn't mind assisting me with a project I'm trying to tackle? If you review my code below, I have 3 conditions within ...
2
votes
3answers
2k views

Button and switch to turn on and off LED and changing after time

I have system connected to an Arduino Uno where I want to read whether the switch is open or closed. Based on if the switch is open/closed, I want an LED light to turn on/off. When the switch is ...
2
votes
1answer
83 views

Digital Input using a button doesn't work properly when using it to control a relay

I'm trying to control a relay both via Bluetooth and using a switch. The problem is that, when the LED is off, I can turn it on with the switch but then if I turn off the switch the relay will stay on....
2
votes
1answer
88 views

How can I make a power button for my project powered by a USB powerbank? [closed]

I've solved the battery power supply issue for my Arduino project by simply connecting a USB powerbank. However, I just realised that I can't come up with a good way to add an on/off button! There ...
1
vote
4answers
377 views

How to boil down analog input to just three cases?

I am investigating the use of a 3-position-switch for one of my projects to switch between different settings using just one analog input pin. For the three positions I am using ground/0V, ~2.5V (via ...
1
vote
2answers
56 views

SPST switch - powered from pin output, or voltage regulator

I have a SPST switch and I just want to sense whether it's on or not. I will then turn on/off a relay depending on the state of this switch. The two options I'm considering are: create a digital out ...
1
vote
2answers
223 views

LED on same Pin as Toggle Switch, not illuminating

I am trying to do something I think should be relatively simple. I would like to read an input from a toggle switch, and have a red 5mm LED indicate the state of the switch. Rather, however, than have ...
1
vote
4answers
1k views

Pulldown resistors and multiple switches

Maybe this is a question for Electronics SE but I’m not a member there yet so hopefully someone will have an answer here. I did an experiment with having some push-to-make buttons connected to my Uno....
1
vote
1answer
112 views

Small Baseball Scoreboard using 2 to 3 breadboards

I'm helping my son start an Arduino small baseball scoreboard (roughly 2 or 3 breadboards in size). Im thinking to use qty 2, 2 digit 7 segment LED's (score of each team), an LCD 1602 module (inning ...
1
vote
2answers
986 views

Need Help in circuit diagram of 8*8 reed switch matrix

I am designing 8*8 reed switch matrix which will be connected to Arduino. I am using Arduino Duemilanove. I have completed the matrix portion but don't know how to connect and where to connect the ...
1
vote
1answer
43 views

LED and Switch Compolation Error Arduino 101

I'm getting an error on line 9 for some reason, (digitalWrite(Sender, HIGH);), and I just cant figure out why. My goal is to have two sets of flashing patterns, one for each switch state. I don't know ...
1
vote
1answer
52 views

My Code turns on my LED even when my switch is not pressed

I am trying to create a circuit that will turn my motor when I clap. When the first limit switch is low, and there is only one clap, a solenoid pin is supposed to be engaged (currently an LED), but ...
1
vote
2answers
1k views

Crosses Initialization in switch case with different size of array per case

void setup() { Serial.begin(9600); } void loop() { time_Text(2); } void time_Text(int PastTo_val) { switch (PastTo_val) { case 1: { int tPTT_y[] = {11, 11, 11, 11}; int tPTT_x[] = ...
1
vote
1answer
33 views

Control 4 digital outputs with one switch

I want to control 4 digital outputs (d0, d1, d2, d3) with one switch. When the Arduino starts, they should all be in state LOW. Now, after pressing the button once, d0 should get HIGH. Another push ...
1
vote
1answer
140 views

Understanding how a tilt switch works [duplicate]

I am learning Arduino and pardon me if this is nooby. I am trying to make an LED glow when the tilt switch is tilted. The LED should not glow if the tilt is in normal position. The circuit and the ...
1
vote
2answers
2k views

Menu with switch case not behaving correctly

I hope this the right place to post this question :) I'm trying to display a menu on a SSD1351 OLED display, to which I communicate with U8glib. I'm trying to obtain an Init screen, then, with a long ...
1
vote
3answers
410 views

Photoresistor and another switch

I am using the circuit diagram below to turn ON/OFF the lights using Photo-resistor. How can I use the Arduino to bypass the Photoresistor effect? Let say I want to turn ON the lights even though ...
1
vote
2answers
394 views

ATtiny85 soft-latching, and sensor-waking: Are multiple switches differentiable by pin change interrupt?

I am using a vibration switch with a pin change interrupt on an ATTiny85 to wake the processor and run some code when the vibration switch grounds an input pin. The circuit is battery-powered, so ...
1
vote
1answer
61 views

Switching low current AC [closed]

What is the simplest way to switch ON/OFF a 60v and 5 mA of current ? I don't want the common relays for arduinos as they make click noise.
1
vote
1answer
763 views

Smooth out digital signal from SW-420 vibration sensor in order to record duration?

I'm attempting to make a sensor that will record the duration and frequency of a pump going off. It always fires for at least 4 seconds, but the duration can be up to 7 days. The vibration sensor I ...
1
vote
2answers
528 views

Attiny85: Watchdog does not initialize properly when using switch(case)

I have a project in which I am putting my ATtiny85 to sleep. Here is the watchdog configuration (in the setup) that works just fine: void setup() { /* Setup the LCD */ lcd.init(); ...
1
vote
1answer
1k views

Switch case problem in Arduino code

I am trying to develop an IR remote for appliances. I have written Arduino code for this purpose. I have used switch case to determine an action from the corresponding IR decode result (HEX), but I am ...
1
vote
2answers
464 views

Switch statements with Bluetooth serial input not working

I am trying to control the brightness of an LED using PWM. I am also trying to make it so that when I click a button on my bluetooth app, I can get it to change the frequency of the PWM pin. For ...
1
vote
1answer
139 views

Capacitive sensor switch

I am trying to get relays to switch on or off based on if I touch a capacitive sensor, basically a light switch. For some reason, I get two readings that are high capacitive readings when I do a ...
1
vote
0answers
34 views

Turning on controller with button and turning off with a timeout

I am making a device controlled by an ESP 8266 and am wanting to save power by having it power down when not in use. The desired behavior is for a momentary button press or vibration sensor activation ...
1
vote
0answers
29 views

How can I get the count of pulses of two encoders on the serial monitor?

I have two encoders; I connected them to pin 2 and 3 and I want to count the pulses of them to make two DC motors to work until it reaches a specified number of pulses, than stop working. I have ...
1
vote
2answers
681 views

Use of array in case statement

I want to know how I can use case statement for each array. Below is my code: int incomingByte = 0; void setup() { Serial.begin(115200); for (int thisPin = 2; thisPin < 6; thisPin++) { ...
1
vote
1answer
432 views

Help: Using if-else on two switch state

Problem I'm stuck on triggering different switch. I'll explain what each of my switch should do. Output of this setup : No output from relayPin mainPin Main power of the switch to control relayPin ...
1
vote
0answers
663 views

Switch on/off LED 24V using a MOSFET

I try to switch on/off IKEA Ledberg LEDs which are powered with 24 V using the setup from this tutorial video: https://www.youtube.com/watch?v=sVyi7yWuXxs I use a IRLB8721PBF MOSFET. When I switch ...
1
vote
1answer
149 views

How to reset an arduino while being able to know which button has been pressed?

Context I keep the board in sleep mode and want to wake it with different buttons. I need to know which button has been pushed on boot. In the following schematic, SW-R is actually used to reset the ...
1
vote
0answers
461 views

Difficulty connecting arduino ethernet with PC using a switch

Facing difficulty connecting arduino ethernet(w5100) with PC using a switch (Dlink). When both are connected directly(p2p) using ethernet cable, arduino device can be pinged. However, when connected ...
1
vote
0answers
250 views

How to recreate this basic ALPS switch board in Arduino?

I want to recreate this existing ALPS switch board (the board on the left) in Arduino, so I can control the switches (and 3 memory + 1 menu buttons) from my laptop. The ALPS switch board connects to a ...
1
vote
0answers
222 views

Adding a kill switch for servos with states - blink without delay code

I have many LEDs and two servos connected to one Arduino Uno, and the servos are programmed to move randomly indefinitely. However, I would like to install a kill switch for the servos by reading a ...
1
vote
1answer
2k views

Constantly read analog in in SWITCH/CASE setup

I'm writing a program with three different cases. Case one an LED is off, in another it is on and in the last case the brightness is controlled by a potentiometer. Each case works as I press the ...
0
votes
2answers
550 views

Switch a 12V 3.3A component from an Arduino

I need turn off and turn on component from an Arduino UNO. How can I do that? I am thinking about some transistor (IRF 530N) but I am not sure about it. Please give me a beginner advice how to ...
0
votes
2answers
39 views

Cycling through switch states

I'm making a desk lamp out of 2x WS2811 strips (attached to the triple ports at top right of board below). The brightness of the strips is controlled by a potentiometer, and the colour by a switch. ...
0
votes
2answers
590 views

Can i use a range in a switchcase like in pascal?

in pascal's case statement i can use this: Var i : integer; ... Case i of 1..5 : DoSomething; end; i was wondering if there is a way in can do this with c/c++ in the arduino compiler using:...
0
votes
2answers
400 views

Alternative of relay

I am carrying out a physics experiment using an Arduino. This experiment requires accurate time measurements of upto a millisecond. However I am using a relay to turn on/off an electromagnet and there ...
0
votes
2answers
218 views

Using a toggle switch to run part of a sketch

First, I am a beginner for this. I just ordered my first book on coding Arduino and I'm working through some simple applications using a DS3231 (that has a temperature reading), LCD, MicroSD card ...