A learning plan for the Kookaberry

Table of Contents
Overview
This tutorial/lesson plan describes how to create a KookaBlockly programme to measure Relative Humidity (RH) and Temperature using the DHT11 peripheral and the Kookaberry microcontroller technology platform.
A PDF document, as well as the resources and learning outcomes component, can be downloaded from the sidebar to the right
Age
This plan is targeted at students in years 5&6 (Stage 3) but can be introduced in Stage 3 and as a bridging course between visual and text-based programming languages in Stage 4. This is because KookaBlockly allows students to see the text-based python code behind the blocks.
Time
This plan (without extensions) should take 1 hour of classroom time per programme.
Learning Outcomes
- Observe how data can be represented by numbers and symbols [screen display)]
- Write and edit a programme in a visual programming language [KookaBlockly]
- Recognise that steps in algorithms need to be accurate and precise [position of text on screen]
- Learn about, use and control an output device [DHT11 peripheral]
- Learn how to trouble shoot through trial and error whilst programming in real time [vary position of text on screen]
- Learn how to use variables in programs [RH and T are two independent variables]
- Learn how to input and change user data in a programme [selection of correct variable description]
- Save and rename files across multiple locations [Add a .kby suffix]
Learning Extensions
- Add an output on P2 if T falls below a specified limit.
Resources
Kookaberry & USB lead

DHT11 Module plus 3pin JST peripheral lead
KookaBlockly Visual Editor
Connecting up
Connect the Kookaberry to your PC or Mac, and plug the DHT11 peripheral into socket P1 on your Kookaberry
DHT11 Programme (Continuous)
The DHT11 module measures two variables – RH and temperature – and transmits their values as digital signals to a connected computer (in this case the Kookaberry). The chip in the module samples the RH and T values at high speed, but a pause between reading their values at the Kookaberry interface is necessary to avoid errors occurring when measured on a continuous basis.
Setting the RH and T Variables
Open KookaBlockly; open the Variables menu; and click on the Create variable grey box. A prompt box will appear on the canvas inviting you to name the variable. Type in DHT11-RH and click OK. The blocks for the RH variable will appear in the Variables menu. Repeat for the Temp variable. The variable (if more than one) can be selected from the dropdown menu within the set and change blocks
Set up Control Loop for Measurement
Open the Control menu and drag the “every loop” onto the canvas. Now bring the DHT11-T variable into the loop and attach the DHT11 sensor block to it as shown Note that the selected pin is “P1” and the variable is “temperature”. Now drag the “sleep for “0.5”secs” block underneath the variable blocks and change (simply type over) the delay to 1 second. This allows for bit of time pass before the DHT11 is asked for the value of the other variable (RH in this case).
Repeat for the RH variable but change the variable name to DHT-RH and change the sensor measurement to humidity using the block’s internal dropdown menus.
Setting screen layout
Now arrange text on the screen to show the name of the programme and the individual measurements of RH and T. Remember that the screen is 128 pixels wide and 64 pixels deep and that character strings start at the specific pixel coordinates set in the display blocks.
Open the Display menu and drag the “display clear” block into the loop. This ensures that the screen is cleared ready for a new measurement at the beginning of every chip cycle. Make sure you add a complementary “show screen” block at the end of the sequence.
Now drag successive “display text value “Hello”” blocks into the loop as shown. The first, second, and fourth blocks simply start printing the required text (just type over “Hello”) at the coordinates shown.
The third and fifth blocks display the value of the variable selected from the Variables menu.
Run the programme and click on “Show display” at the top right of the KookaBlockly window. The display should be as shown below.
Exit Programme
To save this file on your Kookaberry so that you can run it independently from your computer, you have to add
- an Exit programme instruction (press Button A to Exit)
- a screen prompts(what button does what…)
Final Programme
This is what the final programme looks like
Saving it to your computer
Before saving your app you must first create a suitable folder to store it in. A Kookaberry Scripts folder will have been installed in the Users>Public on your Local Disc at the time of KookaBlockly installation. Navigate to this folder and add sub-folders as necessary – maybe call one “kby apps”.
This operation will allow your apps to be called up into the KookaBlockly canvas via the Scripts and Choose a Script menu buttons
To save the file to your computer, click the Save As button in the menu bar. This will bring up all the sub-folders in the KookaBlockly folder which have been created at the time of installing KookaBlockly. Give your programme a name and save it. The kby.py suffix will be added automatically.
Saving it to your Kookaberry
To save it to your connected Kookaberry so that you can run it from its menu independently of the computer, you will need to save it the Kookaberry’s flash memory.
To do this, click Save As and save it in the apps folder of your Kookaberry. Use the same name as you saved it to the kby apps folder.
Last updated:
Year levels:
