This demonstrates the conversion of an analogue to a digital signal; its display as a histogram; and the generation of a control signal when a threshold signal value is reached.
Step 1: Setup
Step 2: Running the app
Navigate to the Analogue app and press Button B to run
What is showing on the screen?
- Top Row: Name of the app
- Second Row:
- % value of the analogue voltage being applied at P4
- Histogram showing the % value graphically. An adjustable threshold level (50%) is shown as a % of a “full” histogram.
- A light bulb icon is shown when the threshold level is exceeded. P2 is also turned ON.
- Third Row: Prompts for peripherals
- Fourth Row: Button A is Exit and Buttons C and D move the threshold value up or down
Step 3: Using the app to turn a light on when a threshold is reached
Turn the potentiometer to vary the analogue input level at P4
In the screenshots above,
- the first shows the LED OFF because the input level (36%) is below the 50% threshold level.
- the second shows the LED ON because the input level (60%) is above the 50% threshold level. The LED connected to P2 will alsp light up.
- the third is the same as the first except that the threshold level has been reduced (by pressing Button C) to 25% and the input level is 20%.
The input can be any compatible analogue input such as a potentiometer, light sensor, hygrometer, sound sensor etc.
The output can be any compatible digital on/off device such as an LED, motor, buzzer etc.
How does it work?
The potentiometer is an analogue input device which adjusts the voltage at the input connector (P4) between Vcc (3.3v) and Ground (0v). The Kookaberry can recognise analogue signals on P4, and converts the analogue to a quantised digital signal by sampling and measuring the instantaneous level at high speed. The circuit that does this is called an Analogue-to-Digital Converter (ADC).
The digital value of the level of the input analogue signal is displayed on the screen as a vertical bar (a histogram).
When the input signal level is at, or beyond, the threshold level, output P2 is turned ON. This means that the voltage level at P2 is raised from ground (0v) to the Kookaberry’s working voltage (Vcc) of 3.3v. In other words, from a digital 0 to a digital 1.
Threshold detection also displays a lightbulb on the screen and lights an LED on the front of the Kookaberry