switch between 2 oscillators? - Page 1
Forum section: electronics / beginners

author: nandoanalog
author_rank: Contributor
timestamp: March 26, 2016, 09:50:30 am
content: Say you have 2 555 timers. One output at 50khz, the other at 100khz.How can one switch between these outputs every millisecond?

author: Zero999
author_rank: Super Contributor
timestamp: March 26, 2016, 10:19:26 am
content: A CMOS switch but why?You could have one 555 timer and just change the value of the resistor/capacitor. There are other possibilities such as a voltage controlled oscillator or microcontroler.

author: danadak
author_rank: Super Contributor
timestamp: March 26, 2016, 10:44:15 am
content: There is also the issue of synchronous switching, so no fore shortened or expandedperiod occurs. Each cycle is one or the optehr period. Do you care ? If not then switchingcaps or timing components would be OK.Regards, Dana.

author: Zero999
author_rank: Super Contributor
timestamp: March 26, 2016, 02:41:12 pm
content: Use a MOSFET to switch an additional capacitor into the RC circuit. When the MOSFET is on, C2 is switched into the circuit which roughly halves the frequency. C1 is slightly smaller than normally required because the MOSFET has some additional capacitance.V2 represents the control signal which changes the frequency.It works fine in LTSPICE but I haven't built it in real life.

author: KM4FER
author_rank: Regular Contributor
timestamp: March 26, 2016, 03:40:28 pm
content: If you want an exact 2:1 ratio I would run the 555 at the highest rate and follow it with a D flip-flop to divide by two. Now you have both frequencies and you can switch between them with a couple of nand gates and a 1KHz square wave.

author: max_torque
author_rank: Super Contributor
timestamp: March 26, 2016, 05:48:14 pm
content: Any small microcontroller (ATTINY etc) with a double buffered Timer Compare Counter would do this easily, although it depends on the accuracy and drift you need for your clock signals?

author: nandoanalog
author_rank: Contributor
timestamp: March 26, 2016, 06:10:35 pm
content: Anything involving programing is much like sourcery to my archaic mind.

author: Zero999
author_rank: Super Contributor
timestamp: March 26, 2016, 06:38:52 pm
content: Quote from: KM4FER on March 26, 2016, 03:40:28 pmI'd omit the 555 altogether and go for the HEF4060 or 74HC4060 and use a 12.8MHz crystal.http://www.nxp.com/documents/data_sheet/HEF4060B.pdfhttp://www.nxp.com/documents/data_sheet/74HC_HCT4060_Q100.pdfQ7 will then give exactly 100kHz and Q8 50kHz.Quote from: nandoanalog on March 26, 2016, 04:15:37 pmHave your requirements changed because that's totally different. A 555 and MOSFET to switch a capacitor in/out of the circuit would work but it isn't as accurate as a crystal. The divider method won't work for 25kHz &38kHz because they're not even multiples of one another.

author: nandoanalog
author_rank: Contributor
timestamp: March 26, 2016, 07:43:42 pm
content: Quote from: Hero999 on March 26, 2016, 06:38:52 pmCan't... That's the actual output I need!

author: bson
author_rank: Unknown
timestamp: March 26, 2016, 08:26:08 pm
content: If you need accuracy and stability better than what a 555 can offer, then because 25 and 38 don't have a common divisor, the easiest is to build two separate XOs and either switch between them using a mux, or design them to have tri-state outputs and complementary OE's so only one outputs at a time. The XO's could produce say N*25kHz and N*38kHz, then you divide the selected output by N. (Crystals and oscillators in the MHz are a lot more common than tens of kHz.) Find an N that will work. At these frequencies the oscillators can simply be based on a couple of inverters each from the same 'HC04 plus a pair of load caps per XO.

author: edavid
author_rank: Super Contributor
timestamp: March 26, 2016, 08:33:03 pm
content: 7.6MHz crystals are readily available...

author: nandoanalog
author_rank: Contributor
timestamp: March 26, 2016, 08:39:32 pm
content: Quote from: bson on March 26, 2016, 08:26:08 pmBeen into electronics for a couple days! You speak mad science! My grasp lacks thoroughly!

author: Zero999
author_rank: Super Contributor
timestamp: March 26, 2016, 09:02:24 pm
content: Quote from: nandoanalog on March 26, 2016, 07:43:42 pmBut you haven't given any indication of the desired tolerance, accuracy or stability which is pretty important for selecting an oscillator.Quote from: edavid on March 26, 2016, 08:33:03 pmYes, you're better off going higher and dividing down.The CD4060 could be used with a 7.6MHz crystal would give 950kHz on the Q3 output, which could then be divided by 38 or 25, to get 25KHz or 38kHz respectively.Quote from: nandoanalog on March 26, 2016, 08:39:32 pmThe idea is to generate a higher frequency, then divider it by a fixed number, using a counter.A counter can be used to divide the frequency of a train of pulses. For example, if a counter circuit is designed to be reset when the total reaches 25, then the it will go to zero every 25 pulses and the output will be1/25of the input frequency.

author: nandoanalog
author_rank: Contributor
timestamp: March 27, 2016, 07:36:00 am
content: I'll look into all the options you guys mentioned. That ltc1799 is looking good!At this point I can only guess my tolerances. From the few tests I was able to do, 3% out of spec seems to still work!

author: Zero999
author_rank: Super Contributor
timestamp: March 27, 2016, 10:45:17 pm
content: Quote from: nandoanalog on March 27, 2016, 07:36:00 amCan we see the bigger picture? What are you trying to do with the 25kHz and 50kHz squarewaves?

author: nandoanalog
author_rank: Contributor
timestamp: March 28, 2016, 11:40:47 am
content: Quote from: Hero999 on March 27, 2016, 10:45:17 pmThat would be 25khz and 38khz (possibly up to 56khz if it turns out to be required). I'd like to drive ir leds. If possible, high powered ones, with some sort of mosfet amp.Nonetheless, I'm very interested in learning different approaches!Right now, the harware part feels very enticing. Brings me back 25 years, when legos where the best thing ever! So, I ordered most of the parts you guys mentioned, to try later on.There's probably a simpler way to output these oscillations with arduino or something similar. But I can't even start to understand a thing about programming.

author: Zero999
author_rank: Super Contributor
timestamp: March 29, 2016, 07:42:47 pm
content: What do you want to do with the IR LEDs?

author: Zero999
author_rank: Super Contributor
timestamp: March 29, 2016, 09:49:47 pm
content: Let me guess, TV remote jammer? lol

author: nandoanalog
author_rank: Contributor
timestamp: March 31, 2016, 01:46:56 am
content: Not rly... A jammer, yes, but for a very different system, at a very different scale.

author: grouchobyte
author_rank: Regular Contributor
timestamp: March 31, 2016, 02:36:06 am
content: Simplicity is the best solutionA 30 cent PIC, 10 lines of code, no external parts. SOT23 5 pin smt package@grouchobyte

author: nandoanalog
author_rank: Contributor
timestamp: March 31, 2016, 05:11:14 am
content: Quote from: grouchobyte on March 31, 2016, 02:36:06 amAbsolutely. But I don't know how to program... Yet!I'm not just interested in making this specific device. This is a gateway for me into the electronics world. After I get this done the old fashioned way, learning some C++ is next on the list.

author: SeanB
author_rank: Super Contributor
timestamp: March 31, 2016, 07:23:45 pm
content: Quote from: nandoanalog on March 31, 2016, 01:46:56 amMaking a camera blanking hat then? To make surveillance cameras not show your image at all by swamping the video image with the light, and the switching to cover both IR lamp drive rates.

author: nandoanalog
author_rank: Contributor
timestamp: April 01, 2016, 08:48:18 pm
content: Quote from: SeanB on March 31, 2016, 07:23:45 pmNow I am!It's a sort of jammer for an industrial site. But I must figure out a way to inject other codes in between jamming pulses. If I know how to switch between 2 oscillators, then I'll know how to switch between good, and corrupt data.

author: SeanB
author_rank: Super Contributor
timestamp: April 02, 2016, 07:11:53 am
content: So a robustness test for an IR crane remote control then.

author: nandoanalog
author_rank: Contributor
timestamp: April 03, 2016, 10:48:57 am
content: Quote from: SeanB on April 02, 2016, 07:11:53 amSomething of the sort..I can't say exactly what it is for. Trade secrets and whatnot...

author: obiwanjacobi
author_rank: Super Contributor
timestamp: April 03, 2016, 01:49:02 pm
content: Security Camera Jammer!(put out so much IR that the camera only see's a very bright spot and not your face)

author: nandoanalog
author_rank: Contributor
timestamp: April 10, 2016, 08:50:47 am
content: Quote from: evb149 on March 26, 2016, 10:17:28 pmThis week, I finally got myself into buying an arduino uno to introduce myself into the programming world... By day 2 my expectations took a dive, as I found it won't do 2 tasks at once. Well, at least not without some of that clever programming that everyone else, but me, can write. (the arduino also seems to bug out a bit even when running those default programs? What gives?)These psoc boards look like they're more powerful. But, can I, an absolute beginner make anything out of them?

author: obiwanjacobi
author_rank: Super Contributor
timestamp: April 10, 2016, 10:12:37 am
content: Stick with the Arduino if you're an absolute beginner. You will need to learn how to do this and Arduino is fine for that. That will take some time. If you're not willing to invest, get out now and do something you like better. If you're getting the hang on the Arduino, then go see PSoC - which is very nice indeed.There is no intrinsic mechanism in the Arduino (AVR MCU) to perform multiple tasks at once (except interrupts - look into that) but it is possible to simulate that - but you have to code it. It involves keeping track of where you are with each task and executing small bits and pieces of the tasks than need to run at the same time.There are libraries that will do this for you, but they usually introduce additional complexities of their own. I do not know any becauseI wrote my own(here usage example).Hope it helps.

author: nandoanalog
author_rank: Contributor
timestamp: April 10, 2016, 10:47:25 am
content: Ought to keep them options open, right?Both platforms it is then. I'll keep tinkering with the arduino, as it seems like a nice device to learn some coding language.But, if the psoc will turn schematics into reality with minimal coding involved, oh boy..... oh boy, oh boy...

author: rstofer
author_rank: Super Contributor
timestamp: April 10, 2016, 11:04:31 pm
content: If you really NEED to do 2 or more tasks at the SAME time, you aren't looking at an Arduino or a PSoC. In fact, from a PC point of view, you would need a multi-core processor with a core per task. OR... You do the thing in parallel hardware. The average CPLD (Complex Programmable Logic Device) can easily work on many concurrent tasks and the FPGA, well, they can do anything. If you can imagine it, the FPGA will probably do it. For a programmer, the most difficult thing about the transition to CPLDs or FPGA is the fact that EVERYTHING happens at the same time. A task may be in a Do Nothing state but that condition is sampled (usually) on every clock and there can be a whole bunch of tasks. All merrily doing their little bit or waiting for a wake up call.What usually happens with a microcontroller is that we either write a 'super loop' that does bits and pieces of each task or we use an RTOS (Real Time Operating System) to divide up the processing power in some kind of priority scheme. For the project, as described to date, a microcontroller with a timer that can connect to an output pin is probably all it takes. Internally, this is hardware with the clock frequencies controlled by setting the timer register. BTW, generate double the desired frequency so you can square it up with a flip-flop on the output. For example, if you need to divide by 38, divide by 19 instead and divide by two with the external flop.The problem with discussing this project is that only one small aspect has been described. Create two carrier frequencies and switch between them. An oscillator and some counter chips ought to do it. But that isn't the project. Now there is a discussion of modulating the carrier. That's an entirely different question. Regardless of the application, where does the modulating frequency come from? Does the <solution> have to create it? And so on... It's pretty easy to underspecify the project, follow a path down a rat hole and then find out that you simply can't get there from here.

author: rstofer
author_rank: Super Contributor
timestamp: April 11, 2016, 02:37:48 am
content: That is VERY cool! Thanks for sharing

author: nandoanalog
author_rank: Contributor
timestamp: April 11, 2016, 09:16:13 am
content: Fkin ace man!

author: nandoanalog
author_rank: Contributor
timestamp: April 13, 2016, 05:22:43 pm
content: While I'm waiting for more gear to arrive, I gave it a go with what I have here (555 stuff and a 4053 mux).Can´t lie, it felt pretty good seeing my first electronics project results on the oscilloscope!