Schematic guidance Arduino analog in with PMW out

Hi All-
This is my first time posting here, I have a somewhat complex looking schematic (for me as a first time electrical engineer). I am looking for help in assessing the design to ensure it will function as intended. As a bit of background, the circuitry is designed around a Arduino MICRO. I have a pinball machine that fires a 26 V AC coil to mechanically move a score reel. There are coils that move the 10’s position, 100’s position and 1000’s position on the game. I would like to use the Arduino MICRO to “watch” the coils fire and then animate some PMW controlled LED lighting that I am also building. I have extensive experience in building the LED and programming the PWM Ouput for control using MeanWell PWM controlled LED dimming power supplies so not as worried about this part. My experience comes from using a pre-assembled Arduino processor with PWM pinouts on a wiring post etc etc so I have never actually built any circuitry and thus am hoping that someone here will be able to look at my schematic and provide guidance as to the proper design and safety.

Here is some nitty gritty details that will inform the design I present.

The pinball machine uses 26 V AC to fire coils. I am wanting to run wires from the coil inputs and then convert that 26 V AC signal into something the Arduino can “see” while isolating the processor from the AC voltage entirely. The way I propose doing this is to rectify and smooth the 26 V AC into a DC voltage. Then use that DC voltage to switch a 24 V DC relay. I am powering the MICRO with a regulated 9V DC power supply to Vin, and taking the 5V out from the MICRO and passing that to the switched side of the relay such that when the coil fires and the relay closes the 5V DC will be directed to an analog input. I have also put in place some 10 K pulldown resistors on that analog input running them to the “ground” which is effectively the negative pole of the 9V DC regulated power supply. There is no EARTH ground on the system anywhere. I then have the PWM output pins wired using as the common lead an wire pulled off the “other” ground pin on the processor (the one on the other side from the Vin and GND pins). With the positive channel specific PMW outputs coming from appropriate output pins on the processor. As one final detail, in rectifying the 26 V AC I use a full wave rectifier circuitry which should result in about 36 V DC as the max voltage which is a bit strong for a 24 V DC relay, so after rectifying and smoothing I pass the rectified DC signal through a 10 V Zener diode wired in “reverse” orientation on the positive leg of the rectified DC voltage just before it hits the relay. So, my understanding is that by using a 10 V zener in this orientation it will “clip” 10V off the signal and I should obtain nearly exactly a 24 V DC input to my 24 VDC relay. The diodes in the rectifier will pull a few volts off and that combined with the 10 V Zener should yield real close to 24 V DC.

The questions I have, upon looking at the schematic DO I HAVE THIS WIRED CORRECTLY. AM I USING THE CORRECT ground pins for the PMW common by putting those across the second gnd pin on the Arduino. Is there anything wrong about what I am doing. Basically, does this look right? Additionally, whats the difference between those two ground pins on the arduino. They must meet somewhere and I assume they meet basically at the last possible place such that they are a little isolated from each other and serve to basically lower any ground noise but I am totally foggy on if I am even using this correctly of might damage the microprocessor given my schematic.

I know there exists opto couplers and other ways of doing this, but this is how I am doing this and I have the parts and in fact have much of the circuitry soldered in place but not so much that if I have an issue I cannot easily fix it as of now.

Here is the schematic as an attachment. I hope this works… else its kinda a lost cause. I cannot get the link functions to find the image… so I will try this and hope for the best

I hate the idea of mechanical relays. If you feel isolation is necessary, I’d prefer opto-isolators.

As one final detail, in rectifying the 26 V AC I use a full wave rectifier circuitry which should result in about 36 V DC as the max voltage which is a bit strong for a 24 V DC relay, so after rectifying and smoothing I pass the rectified DC signal through a 10 V Zener diode wired in “reverse” orientation on the positive leg of the rectified DC voltage just before it hits the relay.

If you simply remove the capacitor, you’ll have rectified 24VDC RMS (minus about 1.4V across the diodes) which is equal in power to constant 24VDC, and the DC relays should work just fine (without the zener).

Arduino analog in…

You do not have an analog signal. You have a digital signal (on or off).

I have also put in place some 10 K pulldown resistors on that analog input running them to the “ground” which is effectively the negative pole of the 9V DC regulated power supply.

I think you are missing the connection to the relay that pulls-up the voltage when the relay switches on…

The Arduino has built-in pull-up resistors. If you enable those, make the relays pull-down to ground, and reverse your program logic, you can simplify your schematic.

There is no EARTH ground on the system anywhere.

You don’t need an earth ground. You just need a common “ground” reference on each side of the isolation. Since they are isolated, there is no need for for the two grounds to be connected.

I don't think you need all that hardware just a diode and 2 resistors should do the job (per reel).

As I understand your problem you need to know when power (24VAC is applied). But if the reel is not moving then I would expect 0V.

In which case you are looking for a change from 0v. So diode as the arduino does not like -ve voltage and a voltage divider to drop the 24 to 5v (or 3.3V). After you have seen the first change ignore all other changes for N micros seconds.

Mark

I more or less agree that some of this is probably not required... So, I admit, over engineering and maybe to the point of failure :slight_smile: But I didn't even know how a diode worked much less what a Zener diode was or even rectification before I started and once I began to learn about things and posting some electrical engineering questions on a relevant forum- I started to get electrical engineer responses and this lead down the path I have taken. I figured out what a opto coupling was after allready getting all the relays soldered down so decided those were good enough. Remember, the pinball machine was made in 1977 and is made of nothing more than a few hundred mechanical relays and reels and its still going strong, so I suppose 4 more relays will not add much maintenance burden to my set up. But the opto coupling would be cool... next time!
Ok... I have modifed my response about 12 times.... so confused.

I see why I want to use a digital read.

I see that some (all?) pins can be configured to put in place a internal pull up resistor of 20K using
digitalWrite(pin, INPUT_PULLUP);

so. Since I need to use 3 pins for PWM ouput. And I need 4 pins as either digital inputs or I could go with analog read and a threshold value as a trigger, my questions follow.

on the ARDUINO MICRO-
Can I configure a pull up resistor on all analog pins using digitalWrite(pin, HIGH), and then simply use digitalRead(pin) to detect it as HIGH (1) or low (0) on any analog input pin?
or is it a hardware limit and in fact only the digital configurable pins (4, 6, 8, 9, 10, 12) have the ability to put that pull up resistor in place, cause I need 3 for PMW so that leave only 3 more which would then force me to run analog input with threshold detection for switch state detection. And force threshold detection on an analog read value as well as requiring that I actually add a resistor inline with the 5V DC into the pin.

Can anyone tell me if there are configurable pull up resistors on ALL analog ports on the Arduino Micro... documentation is sparse to say the least... at least on the microcontroller page there is zero information on this and in the software documentation of this feature there is no note of which pins are enabled.

The Analog In pins are a/k/a "Port C":

1.1.4 Port C (PC5:0)
Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The PC5...0 output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated.
The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running.

http://www.mouser.com/ds/2/36/doc8271-50296.pdf
[link added]