Help designing a circuit - Page 1
Forum section: electronics / beginners

author: danzz
author_rank: Newbie
timestamp: May 30, 2013, 12:10:08 pm
content: Hi AllI have very, but very little knowledge of electronics, but I always liked to mess with circuits... Soon Im going to start a curse of electronics... but meanwhile I wanted to make some gadget for my bike...I need a circuit that is powered by the battery of the bike that when I press once the High beams activates one relay, if I press twice in a short time activates a second relay and if I press three times activates a third relay... I know this is a very easy thing but my knowledge still blanks for it...Any kind soul that would recomend what IC to use, or how I could make this...Thank you very much in advanced!!!!

author: hlavac
author_rank: Frequent Contributor
timestamp: May 30, 2013, 12:29:23 pm
content: This would be classic application for a small microcontroller.Something like ATtiny13A, plus three relay drivers (resistor, transistor, diode each).Maybe another resistor to protect the input from the switch.And a simple power supply with 7805.In software I would run a periodic check that would count the time since last button press and number of presses and do debouncing and switching of the relays.

author: rolycat
author_rank: Super Contributor
timestamp: May 30, 2013, 12:43:54 pm
content: Quote from: danzz on May 30, 2013, 12:10:08 pmIt can be a frustrating subject, but surely there's no need to go that far...

author: thefatmoop
author_rank: Contributor
timestamp: May 30, 2013, 01:26:51 pm
content: the cursed op amp. An op amp that couldn't go anywhere near the rails! If you're a total beginner i'd suggest a micro. More specifically i'd suggest the arduinohttp://www.arduino.cc/I bought one of those my first semester in college and was so interested I switched my major to EE. Now i'm graduating next semester with a good degree rather than a boring cs degree.

author: Paul Price
author_rank: Super Contributor
timestamp: May 30, 2013, 08:27:11 pm
content: Well Danzz, tell me for i not so understand.If I press once, (a button switch I guess) then the headlights operates a relay, what 'bout relay 2 and 3 if they were already on or off? What happens to them?What 'bout if I press twice after relay 1 is already activated? Doesn't relay 1 go off then?What 'bout if the head lights are off?

author: danzz
author_rank: Newbie
timestamp: May 30, 2013, 09:21:02 pm
content: Quote from: Paul Price on May 30, 2013, 08:27:11 pmHi Paul...Not exactly that... Let see... I mean when I press once, twice or three times the highlight beams, its a momentary switch, only stays on meanwhile is pressed, so If I press once it makes a flash with the high lights, if I press twice it will make two flashes... but the circuit I want to make it only takes the positive of the light to tell what relay activate...I will explain fully, I want to use the beam button of the highlight of the bike to activate a relay that will close the switch of a remote control to open the door of the garage... like pressing the button of the remote with the finger, but in this case, the button it would be making a flash with the hightlight of the motorbike that will activate the relay for a moment, closing the momentary switch of the remote control... then the circuit has to identify If I press once, twice or three times to see which relay activate to close the switch of the door I want to controlAs I have 2 doors in my garage at home and one at work, I need three diferent configurations, I know I could make it simplier activating one relay from the beam, the second relay from the claxon and the third from the brake light... but I liked the idea of control everything from the same button...Thanks!!!

author: danzz
author_rank: Newbie
timestamp: May 30, 2013, 09:24:36 pm
content: Quote from: rolycat on May 30, 2013, 12:43:54 pmwell... electronics for me its like a pendent subject, Im always coming with ideas for gadgets to do... but I cant develop many of them becouse my lack of knowledge in electronics...

author: KJDS
author_rank: Super Contributor
timestamp: May 30, 2013, 10:08:20 pm
content: it would be easy but dull to do it with a micro.Another way would be that each time you press the switch it triggers two monostables to give out two pulse, one short and one long, perhaps 10ms and 2 seconds. The long one needs to be retriggerable.Whilst the long pulse is high, use a simple counter to count the number of short pulses. Decode the counter to drive the relays on the falling edge of the long monostable pulse.Whilst i've only provided an idea that could work, there's enough there to get you googling about monostables, counters et al

author: Paul Price
author_rank: Super Contributor
timestamp: May 30, 2013, 11:14:33 pm
content: You got a right idea but you are left with the wrong way to do it. What if the kid across the street see ya do this and it works and then he comes out midnite with a flashlight and flick, flick, button bingo all open doors and a garage sale!

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: May 31, 2013, 07:04:18 am
content: I would definatly sugest a microcontroler, unsure which one though probably arduino if you lr a beginner like me. But what i do remember is that you might want to put a shmitt trigger after the switch before going into the arduino or what ever other micro you would be using.

author: codeboy2k
author_rank: Super Contributor
timestamp: May 31, 2013, 08:29:27 am
content: Quote from: Paul Price on May 30, 2013, 11:14:33 pmLOL @ garage sale I need a new dmmI used to live in a house.. my garage had two doors and my gate had its own motors... my car had a wireless remote with 3 buttons.The wireless remotes are coded, and it's done this way to prevent these midnight garage sales.

author: hlavac
author_rank: Frequent Contributor
timestamp: May 31, 2013, 04:14:16 pm
content: Quote from: danzz on May 30, 2013, 09:24:36 pmWell,Ideas are dime a dozenDevil is in the detailsYou better learn and realize them, talk is cheap

author: MasterOfNone
author_rank: Regular Contributor
timestamp: June 01, 2013, 09:10:58 pm
content: Danzz, I started out being an electronics engineer and hobby programmer, now many years later I’m a software engineer and electronics hobbyist. But I don’t think it’s a bad thing for new starters in electronics to learn about the basic electronic building blocks like 555 Timers, Flip-Flops and Logic Gates, before getting into programming and micro-controllers.To achieve your goals I believe what you should try to do is break your designs down into small blocks and then build and test each block. After you are happy with each block you could try to make them work together.Later you could replace your creations with tiny Micro Controllers, but in my opinion the knowledge you will have gained along the way will still be useful.As an example this problem could be broken down into the following blocks:1) Debounce switch - Mechanical Switches don’t produce clean signals so you need to remove the spikes2) Counter - Count the number of times the button was pressed.3) Input Duration Timer - Timer for the Maximum time allowed between the first and last button press.4) Output Active Timer - Timer to simulate a button press on the remote.5) Latch - Takes the input from the button press count and use it to drive the output relays.6) System Reset Timer - After the process has completed, reset ready for another input.7) Output Switch - use to activate the button on the remote.One useful thing to try to do is create a block diagram for your design, because you can visualise which blocks interact with each other. I produce the block diagram before producing the list above.Timing diagrams are also useful in defining when things should happened. You don’t need any special tools for this just pen and paper.Once your are happy with the blocks you could start designing the system. Definitely don’t try to build a big circuit and get it all working in one go.In my circuit design all the timing and switch de-bouncing are done with good old 555 timers configured as monostables (so there is lots of info out there on the internet of how to set the timings etc), also you can get more than one 555 timers in one package I.e. 556 timer etc.IC5: Debounce Switch (T1 Timing diagram)IC6: Input duration (T2 Timing diagram)IC7: Output Active (T3 Timing diagram)IC8: System Reset (T4 Timing diagram)The counter is built from standard D-Type flip-flops, it just shifts a single bit along each time the switch is pressed. The Nor gate is used to ensure only a single bit is shifted and the bit is available at the start.Rather than using relays and transistors it could be possible to use an electronic switch IC.Also it may not be possible to connect the switch on the bike to the debounce circuit as I have drawn it, because the switch might be configured as a pull-up rather than pull-down. So a simple transistor and current limiting resistor could be used to invert the signal.

author: Unknown
author_rank: Unknown
timestamp: June 02, 2013, 07:35:35 am
content: MasterOfNone, I both agree and disagree. I think that you have the right idea, for sure, but I also think that when you're dealing with a learning curve that is as steep as it is when starting out in electronics, a little "instant gratification" can go a long way. It's the psychological "hey, I actually CAN do this" thing that allows people to start digging in deeper.So, for that reason, I think a microcontroller is a great thing to start out with. I'd suggest the arduino as a platform, and then using an arduino nano (or some such) to actually create the "production" device. Then, once it's all working, then perhaps going back and creating a discrete circuit to understand how to do it another way. But it's just cool to have something sitting there that you built, and that works.Never underestimate the power of a feeling of accomplishment.Just my opinion. The arduino filled this role for me. My self esteem has taken a major hit over the past few years when it comes to electronics, and the arduino was what I needed to bust through that jam and prove to myself that I actually was capable of building stuff that works. Then I went from there.

author: MasterOfNone
author_rank: Regular Contributor
timestamp: June 02, 2013, 01:31:58 pm
content: Quote from: duskglow on June 02, 2013, 07:35:35 amYou've made some great points and there is no denying that things like the Arduino will/has encourage many to get into electronics, they’ll start adding custom sensors and indicators. Also if anyone starts down this path and decides to take things more seriously, then hopefully they’ll learn about building basic blocks from things like flip-flops and gates on their Electronics course.I know you didn’t say this, but some could argue;Have you ever seen a teardown of a new piece of equipment that was built from Flip-Flops and Gates and 555 timers. Why bother learning about this anyway, why not just use a bigger or faster processor/microcontroller. But in my opinion it’s still useful to know how things can be built from a low level. For example a programmable logic design (CPLD/FPGA using a HDL) can look like a High level language like C at a glance, and in some case the can be written like C. But depending on what design is for it may be way better to implement some functions using flip-flops, latches shift registers etc, rather than sequential C like constructs. So I believe understanding logic and flip-flops is still relevant, 555 timers not so much.Anyway one reason for suggesting trying to build a circuit without using a Microcontroller was because Electronics Engineer means too many different things, or to put it a better way it covers too many different skills. Over the years I have known a number of electronic engineers who I considers as being really good, but they struggled with software, no matter how simple it was. Which is fine you may say because Software Engineering (or programming) isn’t considered Electronic Engineering (or it wasn‘t in my day). But my point is these engineers that struggle with S/W would have probably given up on Electronic Engineering if their path into it was to program Microcontrollers ( no matter how simple it may seem to you). So for some that are interested in electronics messing around with flip-flops and gates may be a better option, even if it will take a lot of effort to achieve what could be achieved with a few lines of Arduino Sketch.But on the other hand breaking the design down into blocks may not be that easy when you are starting out, and I don’t have any tips on the best way to approach this.

author: Unknown
author_rank: Unknown
timestamp: June 02, 2013, 03:31:00 pm
content: You're right that designing software and working with hardware are two different skillsets. For me, software is not a problem. I've spent nearly 20 years working with it in one way or another, so I'm not scared at all to dig right into it. The hardware is the more difficult thing for me, once I've got a circuit that works stably, programming the atmel or whatever is a piece of cake. I picked that up in a couple of hours - though getting the timing right can be a little hard. And maybe for someone who has no experience whatsoever with programming, building something out of discrete components may be more rewarding.I guess what we're really saying, when we combine our points is "find what works for you and go with it".I'm a very practical person, myself. I tend to take the shortest distance possible between point A and point B, where point A is having an idea or a goal, and point B is accomplishing that goal. And in many cases for me, an arduino (or some such) fits that bill nicely. May not be the same for others.

author: meltbox360
author_rank: Contributor
timestamp: June 03, 2013, 02:15:16 am
content: I may be a bit late to the party but the ATMEGA 168/328 chips are great for just about anything. It sure helps that Arduinos are built off of them but there's a ton of stuff out there for code for them either way.EDIT: I should say they are a great chip to start with. The through hole version is a bit big but a nice choice for learning. I'm still using it, still learning.

author: danzz
author_rank: Newbie
timestamp: June 04, 2013, 09:27:19 am
content: Thanks a lot for all the help!!!...I agree with the matter that starting with flip flop and logics gates its the best way of starting... But it too much for me right now becouse my little knowledge... I think that before starting this little project... I should learn a bit more...well.. a lot more!!!....also... I have been searching about arduino... its seems a whole world for start as well, I have done a little bit of programming in the past... so I might refresh a bit with an arduino nano and a relay board that are avaible in DX...Thanks a lot for all the ideas!!!...