Viewing 4 reply threads
  • Author
    • #6275

        Hi folks,

        As promised, I will publish here a design of a PWM (Pulse Width Modulation) so we can study it’s behavior on different circuits.

        Therefore we will reuse the PWM of the morse generator of the previous post and do some experiments with it.

        What is PWM ?

        Well, when we look at the figure of a PWM, we see that we have a pulse with a steady frequency (period).

        We also notice the Duty cycle. This is the time a signal is in a high (on) state versus a low (off) state.

        So, we see that when we have a short duty cycle of 10%, the high (on) is very short. This means that our lamp will  turn on only a very short time between a period

        When we have a 90% duty cycle, the lamp will be turned on much longer between this period.

        The Period is an amount of time the waveform (in our case a square wave) occurs again. The symbol is T.

        The Frequency is the number of periods within a unit time (or a second). The symbol is f.

        The relation between these two is : f = 1/T


        Now, it’s time to setup our Lectron circuit :

        PWM light

        After building the circuit, turn the potentiometer and notice how the lamp changes light.

        You may also observe that the lamp slightly flickers. The values of the different components were chosen so you can see that the frequency of our oscillator doesn’t change when turning the knob.

        Later on, we will add small modifications to add extra functions.

        Any idea why we put the lamp in the emitter circuit ?

        How does this circuit work ?

        We have an astable multivibrator. The 2 transistors switch alternately on and off. The frequency of this switching is merely determined by the 2 capacitors of 0,1µF.

        When we turn the potentiometer to the left, the charging of the capacitor situated at the bottom happens faster while the other capacitor charges slower. This results in an even frequency but with other duty cycle.

        When we set the potentiometer in the middle, the 2 capacitors charge equally.

        The situation is reversed when we set the potentiometer fully right.

        We set the lamp in the emitter circuit because it will follow the voltage at it’s base (no amplification).

        Anyone fancies more basic circuits around transistors ? If so, I can use the Lectron system to make some circuits with explanations in this forum.

        So, enough for today ! We will continue this topic soon. Time for you to build the circuit and enjoy the lamp dimming.




      • #6278

          Hi Frank,

          I am going to call you Professor Frank now!  Your work and contributions are always excellent and offer real learning opportunities!  Thank you so much.  I am always eager to see what you come up with next.  

          Best regards as always,

          • This reply was modified 4 years ago by Michael.
        • #6283

            Hi all,

            Professor is too much honor, Michael ! I’m just a enthusiastic user of the Lectron system 😆

            Today, we’re going to do some more experiments with the PWM to study it’s behavior.

            I think everybody’s familiar with an astable multivibrator ? If not i’d like to refer to the manual included with the start system page 12 and page 152 where you can find all details.

            The differences between the manual and the circuit proposed here, is that the left and the right sides are symetrical, which means that when setting the 250K potentiometer in the center position, the output is a 50% duty cycle square wave.

            You can see in the schematic that the collector of the transistor at the left is connected via a resistor of 3,9K with the battery.

            The transistor at the right of the astable multivibrator is connected via 2 resistors of 2,2K and 1,5K in series, giving a total resistance of 3,7K which is a close value to the 3,9K.

            So, we can say that both transistors work exactly the same way.

            You may have noticed that the output of the transistor at the right is connected to an emitter follower circuit driving the lamp. This has the property of having a high input impedance. This causes almost no load on our astable multibirator.

            Now, let’s change both capacitors into 10µF. The top capacitor has the + at the left. The bottom capacitor has the + at the right. Now, you can clearly distinguish  the on and off behavior of the duty cycle when adjusting the 250K potentiometer.

            Now, let’s change the bottom capacitor into a 0,1µF and the top capacitor into 47nF.

            You see that our lamp doesn’t flicker anymore and that the dimming is very noticeable.

            The principle of PWM is used to translate the digital output of a microcontroller into an analogue signal. The next experiment will show you how.

            Let’s build the circuit according to following diagram :

            PWM to analogue

            Before you turn the power on, adjust the 250K potentiometer completely counter clockwise.

            You see that the lamp is barely on and the meter deflects a small amount.

            Now, when you turn the potentiometer, the lamp gradually lights and the meter deflects more.

            Stop turning the potentiometer till the meter reaches “6”.

            Till now, the meter is fed by a pulsating square wave. Since the meter needle is somewhat slow in it’s movement and the frequency of the oscillator is high enough, it doesn’t swing from left to right.

            Let’s now push the left switch. You’ll see that the meter indicates a higher voltage.

            When you press the right switch, the meter even reaches a higher value.

            By adding a capacitor, we create a low pass filter. By choosing the correct value of the resistor and capacitor, our circuit will perform at it’s best. We can say that the 10µF capacitor suits best here.

            The next graph visualizes the PWM versus output signal

            PWM analogue graph

            This kind of circuit is often used where a microcontroller with PWM output can control analogue devices such as lamps, motors, etc.

            It’s quite possible that the brightness and/or color of the led light bulbs in your house use this kind of circuit.

            Don’t be afraid to experiment with this circuit. Here are some hints :

            • Try different values for the capacitors (pay attention to the + and -)
            • Connect the 100K resistor of the right transistor in the astable circuit directly to the voltage rail instead of the 250K potentiometer. Turn the potentiometer and see what happens !
            • Do you think the speed of the multivibrator affects the meter deflection ? Check it out while pushing one of the 2 switches !

            Happy experimenting 😆

          • #6286

              Hi Frank (Professor!),

              Thanks again for this great exploration!

              I am writing to you while in a ICE train returning from Munich to Frankfurt.  Wonderful day visiting with the son of Edzard Timmer (the designer of the Cybernetic models).

              Have a great week coming up and I will keep you in the loop with the Lectron System developments.


            • #6294

                Hi everybody,

                And perhaps the speed of the train is also controlled by PWM 😛

                The circuit proposed now is probably the best we can achieve with the Lectron basic set. At minimum settings of the potentiometer, we have about 5% duty cycle. At maximum, it’s about 95%.

                The meter after the low pass filter shows a DC voltage ranging from 0 Volts to a 5 Volts.

                From the diagram, we see that the two 100K resistors are lowered to 10K. This change of value causes the capacitors to charge and discharge faster, resulting in (almost) perfect PWM.

                I’ve also added a 47 Ohm resistor to protect the lamp.

                The meter indicates voltages from 0 Volts to 5 Volts (2 x 100K resistors in parallel).

                The lamp smoothly lights from dark to very bright 💡

                And here’s the circuit, build in only 2 minutes !

                PWM to anaV2

                Here’s also a small video of the circuit in action : Lectron PWM

                Many greetings

            Viewing 4 reply threads
            • You must be logged in to reply to this topic.