Author Topic: Help designing a circuit  (Read 4991 times)

0 Members and 1 Guest are viewing this topic.

Offline danzz

  • Newbie
  • Posts: 4
Help designing a circuit
« on: May 30, 2013, 10:10:08 pm »
Hi All

 I 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!!!!
 

Offline hlavac

  • Frequent Contributor
  • **
  • Posts: 525
  • Country: cz
Re: Help designing a circuit
« Reply #1 on: May 30, 2013, 10:29:23 pm »
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.
Good enough is the enemy of the best.
 

Offline rolycat

  • Super Contributor
  • ***
  • Posts: 1089
  • Country: gb
Re: Help designing a circuit
« Reply #2 on: May 30, 2013, 10:43:54 pm »
Soon Im going to start a curse of electronics...

It can be a frustrating subject, but surely there's no need to go that far...
 

Offline thefatmoop

  • Contributor
  • Posts: 31
Re: Help designing a circuit
« Reply #3 on: May 30, 2013, 11:26:51 pm »
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 arduino

http://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.
 

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1419
Re: Help designing a circuit
« Reply #4 on: May 31, 2013, 06:27:11 am »
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?
 

Offline danzz

  • Newbie
  • Posts: 4
Re: Help designing a circuit
« Reply #5 on: May 31, 2013, 07:21:02 am »
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?

Hi 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 control

As 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!!!
 

Offline danzz

  • Newbie
  • Posts: 4
Re: Help designing a circuit
« Reply #6 on: May 31, 2013, 07:24:36 am »
Soon Im going to start a curse of electronics...

It can be a frustrating subject, but surely there's no need to go that far...

well... 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...
 

Offline KJDS

  • Super Contributor
  • ***
  • Posts: 2397
  • Country: gb
    • my website holding page
Re: Help designing a circuit
« Reply #7 on: May 31, 2013, 08:08:20 am »
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

Offline Paul Price

  • Super Contributor
  • ***
  • Posts: 1419
Re: Help designing a circuit
« Reply #8 on: May 31, 2013, 09:14:33 am »
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!
« Last Edit: May 31, 2013, 09:26:21 am by Paul Price »
 

Offline carbon dude oxide

  • Frequent Contributor
  • **
  • Posts: 429
  • Country: gb
Re: Help designing a circuit
« Reply #9 on: May 31, 2013, 05:04:18 pm »
I would definatly sugest a microcontroler, unsure which one though probably arduino if you lr a beginner like me :D. 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.
-----
Everything Should Be Made as Simple as Possible, But Not Simpler
-----
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1838
  • Country: ca
Re: Help designing a circuit
« Reply #10 on: May 31, 2013, 06:29:27 pm »
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!

LOL @ garage sale  I need a new dmm :-DMM

I 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.

 

Offline hlavac

  • Frequent Contributor
  • **
  • Posts: 525
  • Country: cz
Re: Help designing a circuit
« Reply #11 on: June 01, 2013, 02:14:16 am »
Im always coming with ideas for gadgets to do... but I cant develop many of them becouse my lack of knowledge in electronics...

Well,
  • Ideas are dime a dozen
  • Devil is in the details

You better learn and realize them, talk is cheap :)
Good enough is the enemy of the best.
 

Offline MasterOfNone

  • Regular Contributor
  • *
  • Posts: 123
Re: Help designing a circuit
« Reply #12 on: June 02, 2013, 07:10:58 am »
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 spikes
2) 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.   

« Last Edit: June 02, 2013, 07:39:17 am by MasterOfNone »
 

duskglow

  • Guest
Re: Help designing a circuit
« Reply #13 on: June 02, 2013, 05:35:35 pm »
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.
 

Offline MasterOfNone

  • Regular Contributor
  • *
  • Posts: 123
Re: Help designing a circuit
« Reply #14 on: June 02, 2013, 11:31:58 pm »
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.

You'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. 
 

duskglow

  • Guest
Re: Help designing a circuit
« Reply #15 on: June 03, 2013, 01:31:00 am »
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.
 

Offline meltbox360

  • Contributor
  • Posts: 20
Re: Help designing a circuit
« Reply #16 on: June 03, 2013, 12:15:16 pm »
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.
« Last Edit: June 03, 2013, 12:19:06 pm by meltbox360 »
 

Offline danzz

  • Newbie
  • Posts: 4
Re: Help designing a circuit
« Reply #17 on: June 04, 2013, 07:27:19 pm »
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!!!...
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf