I'm a software engineer trying to get into the world of electrical engineering. I thought I'd start my first project and make a nixie clock (clicheI know) but I want very specific design elements. Eventually, after making the clock, I want to make a 3d mold, make a very nice concrete case from a negative etc.
The idea was to have a toggle switch denote that it uses internet time or manually set time, with a rotary encoder next to it. That's said, remember how I said I wanted very specific design elements? Well, I wanted a brass toggle that's inspired by the marshall speakers.
Is it possible to use a toggle like the one I posted in the design?
Is it a horrible idea to hook up a toggle to the vcc of a rotary and program the board to use manual time when there's a signal from the rotary?
Apologies in advance if these are really newbie questions. I haven't seen them directly answered. Any toggle I've seen is a plastic switch type deal, not something like this. I'm also open to any suggestions you might have. Thanks!
Never use any component at its rated value. If you do they will have a shorter life.
As a rule of thumb always de-rate by at least 80%. But generally the more you de-rate the longer the life of a component will be. Longer life components produce more reliable systems.
Rotary encoders don't have a Vcc. Do you mean a rotary encoder on a PCB module where one of the pins on the PCB is marked Vcc? On these (badly designed) modules, you connect the Vcc pin on the encoder board to the Vcc of the Arduino. If you connect the toggle switch to that pin also, you are really just connecting the toggle switch to the Vcc of the Arduino also.
This is not the best way to connect any switch or button to the Arduino, firstly because it forces you to connect a wire from the Arduino's Vcc pin to the switch, and if that wire breaks loose, it could cause a damaging short circuit. Secondly, because you then need to add a pull down resistor to the Arduino pin, that the switch is connected to, to prevent the pin from floating.
The better way to connect a switch or button is to connect it between the Arduino pin and ground. Then you can use the Arduino's internal pull-up resistor to prevent the pin from floating, so no need to add an external resistor, and the short circuit danger I mentioned is avoided.
I just had a thought. Maybe you intended to connect the toggle switch between the Arduino Vcc and the encoder board's Vcc pin? Your thinking is that when the toggle switch is in the off position, no signals from the encoder will be read by the arduino pins? If I'm right, don't do it. The problem that will cause is that when the switch is in the off position, the Arduino pins will be floating and will read random noise from the environment.
I meant the +5v power pin to the rotary. The idea being when there's power the rotary sends back a signal when there's no power no signal so the Arduino just has to check to see if there's a signal to use manual rotary set time vs NTP. Now, granted there's going to be a software lock and unlock to that to prevent accidentally changing the time but that's how I'm imagining it to work.
There's no meaningful 'no signal' input to a pin. The Arduino (or any micro-controller) can only detect 2 states: high or low, nothing else. Hence whatever signal you present to a pin it can only be detected as high or low, nothing else. A rotary encoder connected correctly presents to each of the 2 pins it is (usually) connected to either ... or ... (fill in the blanks).
If you change the wiring, say by disconnecting the 5V connection to the encoder then there isn't anything else that the Arduino could read other than ... or ... (fill in the blanks).
What will happen if you do as you suggest is that instead of a clear, defined and predictable ... or ... you will instead get an unpredictable ... or ..., but it will still only be ... or ....
If you want a switch to disable reading the encoder then it would make more sense to connect it to a different pin and check its state and only read the encoder if the switch in in whatever you define as the 'active' state.
However, I do think this is a lot of theoretical discussion about not much. I urge you to do what electronics is really good for: get an encoder and a switch and wire them up in as many different ways you can think of, write some code and see what happens. If you don't understand the results come back and ask some questions.
Oh, and please, PLEASE do not use chat GPT to write your code, it will end badly.
That switch has riveted construction for the terminals - I've had bad experiences before with that - works loose over time, easily stressed mechanically...