# Need help designing a circuit to control analog

#### Ed. M.

Joined Nov 8, 2017
41
Hi,
I'm a complete beginner. I have a need to create a circuit that will take analog inputs and given certain conditions control an output analog device.

My inputs are a series of lights, numbers 1-25, each operating off 5-7V. If a certain combination of lights is active, I want to generate a signal to activate a stepper (analog device). For example, if lights 3, 4, and 5 are all active, I want to increment the stepper four times. If lights 11, 12, 13, and 14 are active, I want to increment the stepper 20 times, etc.

What's the easiest way to do this? I'm a computer program, but only have very basic knowledge of analog circuits, like I can measure voltage across a light socket.

#### crutschow

Joined Mar 14, 2008
34,405
You can use a microcontroller's analog input to sequentially scan the status (voltage) of the lights (can use an analog multiplexer, such as a CD4067, for that).
From that you know which lights are on, and can program the micro to output the desired number of stepper steps.

Sound workable?

#### MrChips

Joined Oct 2, 2009
30,792
All digital is analog. A stepper motor is a analog device that uses discrete digital voltage levels. You will need a stepper motor driver circuit interfaced to a digital controller such as an MCU (for example, Arduino). What is the MCU of your choice?

#### crutschow

Joined Mar 14, 2008
34,405
All digital is analog.
For the actual circuit operation, but not for the digital logic.

#### BobTPH

Joined Jun 5, 2013
8,935
There are no analog signals involved in your problem description. Each light is either on or off (digital) and the output is a specific number of pulses to a stepper controller (digital.). A microcontroller is the obvious way to go.

Bob

#### rahul411

Joined Feb 19, 2018
260
Use LDR to detect the light

#### Ed. M.

Joined Nov 8, 2017
41
Thanks for the suggestions I really appreciate it. I've never worked with a microcontroller; could you please point me to a couple of suggested ones that might work? I've done all my development work in Visual Studio. I'll look around for some tutorials on programming microcontrollers, but if you have some good links please forward them.

#### rahul411

Joined Feb 19, 2018
260
Use Arduino UNO board... It has everything you need.

#### BobTPH

Joined Jun 5, 2013
8,935
Second the Arduino if you have not used micros before.

If you already are familiar with C or C++, programming them should be a snap for you.

Bob

#### Creation Opj

Joined Jul 3, 2019
8
Which stepper are you using?

If you haven't selected any yet, I advice you to use this one: 28byj-48

It already has the driver you'll need to set the voltage required for each step. And all the work left will be to program it with a microcontroller, as most people suggested arduino is the way to go. And there are also plenty codes on the internet for steppers with arduino.

Good luck.

Joined Mar 10, 2018
4,057
You can do most of this in a PSOC except for high current driver needed for
stepper. But all the timing can be done, as well as all the analog signal conditioning.
DAC, A/D, OpAmps, Muxes, SAR, DelSig, COM, logic........

One chip.

https://www.cypress.com/applications/stepper

Here is a kit (but I think too expensive). https://www.cypress.com/documentati...8ckit-037-psoc-4-motor-control-evaluation-kit

Use a PSOC 5LP on the \$ 10 board and just change the project from PSOC 4 to 5LP.

https://www.cypress.com/documentati...oc-5lp-prototyping-kit-onboard-programmer-and

Here is solution project example (in IDE as a choice) -

Above all onchip, except resistors and power drivers, and many more resources still available.

Just drag and drop components onto schematic, a component is an onchip
resource, wire them up internal and to pins, write code (this example comes
with code), and build/program.

A series of short videos to train - https://www.cypress.com/video-library/PSoC-Software/psoc-creator-101-lesson-1-introduction-0/108116

IDE (PSOC Creator) and Compiler free.

Regards, Dana.

Last edited:

#### Ed. M.

Joined Nov 8, 2017
41
I like what I’ve seen on the Arduino UNO. My question is I have 25 input lights. How would I use that board with that many inputs or do I need a different board? Thanks.

#### djsfantasi

Joined Apr 11, 2010
9,160
I like what I’ve seen on the Arduino UNO. My question is I have 25 input lights. How would I use that board with that many inputs or do I need a different board? Thanks.
Another Arduino model, the Arduino Mega2560, has somewhere around 50 GPIO (general purpose input/output) pins. Plenty for your 25 lights.

You still have the simplicity of learning a microprocessor and plenty of online support.

#### djsfantasi

Joined Apr 11, 2010
9,160
More on the Mega..

Joined Mar 10, 2018
4,057
If board size is issue, and component count, this might be useful -

Post # 11

Regards, Dana.

#### Attachments

• 975.9 KB Views: 3

#### Dilberto

Joined Dec 12, 2015
1
Another Arduino model, the Arduino Mega2560, has somewhere around 50 GPIO (general purpose input/output) pins. Plenty for your 25 lights.

You still have the simplicity of learning a microprocessor and plenty of online support.
That's my opinion, too. Arduino Due can be used also, but is more expensive and should be the user's choice only if Mega is unavailable.