Go Down

Topic: Astable Multivibrator (Read 2291 times) previous topic - next topic


Hi everyone,
For research project purpose, I would like to implement an astable multivibrator within the microcontroller leaving outside the resistance (the sensor) and the capacity required.
For my measures, I need to slow down the astable multivibrator output using the internal prescaler (e.g.), and further I need an internal clock with a minimum frequency of 10 MHz. I would like to obtain as final output, the length of the high period and the length of the low period.
I would like to know if it is possible to carry out this process, and some ideas.

Thank you very much for your attention, and the help you can give me.


Here's some simple code that will work to emulate an astable multivibrator.  You will have to download the timer1 library from arduino website.  This produces a 50% duty cycle 10kHZ square wave pulse on a 28Hz carrier frequency square wave (36ms period). 

In other words, for the first 18ms half of the 28Hz square wave, a 10kHz square wave "pulse" is generated as output.  For the second half, the output is forced low.   

Parameters, and pulse widths of both the carrier and pulse adjustable within the program to suit your needs.

This particular waveform was written to transmit a signal to a PetSafe wireless barrier fence collar receiver (details can be seen on Instructables.com website:  http://www.instructables.com/id/PetSafe-Pet-Barrier-Transmitter/)

Here is the code:

*  Astable multivibrator signal emulator

#include "TimerOne.h"

void setup()
  pinMode(9, OUTPUT);   // set up pin 9 as output
  Timer1.initialize(100);    // initialize timer1, and set a 100us second period (10KHz)

// the loop routine runs over and over again forever:
void loop()
  Timer1.pwm(9, 512);         // setup pwm on pin 9, 50% duty cycle
  delay(18);                             // wait for 18ms
  digitalWrite(9, LOW);       // turn the LED off by making the voltage LOW
  delay(18);                             // wait for 18ms


need an internal clock with a minimum frequency of 10 MHz.

Not with a UNO you won't. You need a Due for that sort of speed.
Why do you want the R and C external? Is that going to control the oscillator?
In which case you do not need a timer, however you will not be able to go at 10mHz even with a Due because the A/D you will need to use is not fast enough.


Hi, i have a question for you. Can i produce a signal 34kHz or around this? Thank you.


I think you should start your own thread about this. This thread started in 2013, got two answers in 2014, now you are adding to it in 2015.
Steve Greenfield AE7HD
Drawing Schematics: tinyurl.com/23mo9pf - tinyurl.com/o97ysyx - tinyurl.com/q7uqnvn
Multitasking: forum.arduino.cc/index.php?topic=223286.0
gammon.com.au/blink - gammon.com.au/serial - gammon.com.au/interrupts

Go Up