Dimmer

An app for the Kookaberry

Tony Strasser

Developed by
Tony Strasser

AustSTEM

This app demonstrates how a continuously variable analogue input can be changed into a continuously variable digital output to control the intensity of a purely digital peripheral such as an LED.

The app uses Pulse Width Modulation (PWM) to vary the duration of time the output digital signal is ON and OFF (the duty cycle) within one cycle of the PWM frequency. PWM is explained later in this app description.

The app accepts any analogue peripheral on input P4 and outputs a corresponding PWM digital waveform on P1.  Any PWM controllable peripheral with appropriate current demands (such as a LED, or a motor with power module between) can be connected and regulated by the output.

The current drawn from any output connector on the Kookaberry should not exceed 100mA if damage is to be avoided. All the output peripherals in a Kookaberry Class Kit such as the LED; the DC Fan Motor; draw less than 100mA and are safe to be plugged directly into P1.

Peripherals such as motors for traction or robotics; pumps; requiring heavier current (and thus more torque) can still be controlled by a Kookaberry running the Dimmer app – but will need to use the Quokka power board.

Directions (Dimming a LED)

Step 1: Setup

Plug the LED into P4 and the LED into P1

Step 2: Running the app

Using the Menu on the Kookaberry, navigate to the Dimmer app and press Button B to run

What is showing on the Home screen?

  1. Top: Name of app and input and output connectors

  2. Middle: Graphics of analogue input and digital output.

    1. The vertical bar graph follows the analogue input over the range 0 to 100

    2. The line graph is a single cycle of the corresponding PWM waveform. As the analogue input varies, the waveform will also vary to a corresponding duty cycle.

  3. Next Row: The level of the analogue input and the frequency of the PWM signal

  4. Bottom: Button A is Exit. Button B varies the frequency of the PWM waveform. Preset frequencies are 16, 20, 30, 50, and 100Hz.  The lower frequencies will demonstrate the attached LED visibly flickering.

Pulse Width Modulation

If the power to a peripheral like an LED or a DC motore is switched (pulsed) rapidly ON and OFF – with the width of the OFF time greater than the width of the ON time – the average power to an individual LED will be less than maximum, and the intensity will be proportional to the width of the ON time.

The percentage of time that a digital signal is ON over an interval or period of time is called the Duty Cycle. This period is the inverse of the frequency of the waveform.

If a digital signal spends half of the time on and the other half off, we would say the digital signal has a duty cycle of 50% and resembles an ideal square wave. In this case the intensity of the LED would be half its maximum value.

If the percentage is higher than 50%, the digital signal spends more time in the ON state than the OFF state and vice versa if the duty cycle is less than 50%. Here is a graph that illustrates these three scenarios:

In the case of an LED, if the frequency is fast enough (typically >50Hz) the eye’s persistence of vision will make the LED appear to be on all the time without any flickering

Peripherals used by this app

Version:


Last updated:1 week ago


Device:Kookaberry


Radio code:


App ID:...


lib_dependencies:


root_dependencies:


Downloads

Download on GitHub
Image

Support

Issues resolved in the support forum:

8 out of 11
View support forum

Leave a Reply