Let’s examine your rPI host and get to know it. It has to be handled delicately at all times!. We will now power it up and wait for 2 minutes. We can then make sure it shows up on the Bush network!

🟠 ✅ Do you see Confetti ??
🟠 ✅ Do you see the JupyterLab hosted on your Raspberry PI ??
Start by renaming one of the userX folders with just your lowercase firstname all one word no spaces. Double-click this folder.
🟠 ✅ make sure you create and edit all of your own notebooks only in this folder. Do NOT EDIT another users files!!
Download the sysinfo.ipynb by right-clicking this link and select ‘Save Link As’ and then drag the file to your folder PI’s JupyterLab. Run the sysinfo Jupyter Notebook and document your results in a dated page of your workshop notebook.
🟠 ✅ Did you make sure that you are running your notebook from your folder?
🟠 ✅ Did you write down the your RPI’s sysinfo results in your field notebook on a dated page?
We will use the Multimeter to measure some voltages from the pins. See the pin layout of your Raspberry PI Host below. Place the Black probe of your Multimeter on any GND ground pin of your rPI and the Red probe on the 3V3 or 5V pin of your rPI. Write down the voltage you measure from the 3.3 volt pin and the 5 volt pin on your Raspberry PI on the previously dated page of your Workshop Notebook.

🟠 ✅ Did you write voltages down on the dated page of your Workshop Notebook ??
First, let’s learn about using a breadboard to make solderless electronic circuits.

Download the first_notebook.ipynb by right-clicking this link and select ‘Save Link As’ and then drag the first_notebook.ipynb file from your laptop to your folder in rPI’s JupyterLab.
🟠 ✅ Did you make sure that you are creating this notebook in your user folder?

Wire-up your RPI following your own hand-drawn diagram. Note LED +lead should be connected to GPIO4. The other (-ve) lead of the LED can be directly connected to the ground via the -ve rail of the breadboard.

Now you are ready to Run the Jupyter Notebook first_notebook.ipynb. Your notebook should like the image below. Click the red-circled button to Run your notebook.

🟠 ✅ Only one user can run the notebook a time!
🟠 ✅ Did you create, and upload your wiring diagram and verify the corresponding code in the Jupyter Notebook ?? If not, please do this as it is part of your assessment!
🟠 ✅ Do you see your LED blinking? If not, please debug with your partner by looking at the wiring diagram, and code. If this fails, call me or the
Change LED to GPIO port to 18. The other (-ve) lead of the LED can be directly connected to the ground via the -ve rail of the breadboard. Change the code correspondingly and and run to see if it works again!
🟠 ✅ This is practice only - you do not need to draw a wiring disgram diagram for this. Does it work ? If not, please debug with your partner or call me or the TA to assist you
Download the button_test.ipynb by right-clicking this link and select ‘Save Link As’ and then drag the button_test.ipynb file from your laptop to your folder in the rPI’s JupyterLab.
Create a hand-drawn wiring diagram for the following circuit imaged below. Modify the template of the wiring diagram given to you to create this drawing. In this circuit we are changing the LED to GPIO port back to GPIO4. Show the button or LED in your drawing further down the breadboard so as not to interfere with the led previously installed. Note LED +lead should be connected to GPIO4. The other (-ve) lead of the LED can be directly connected to the ground via the -ve rail of the breadboard. Show the button connected to GPIO17 and the other to the ground rail.

🟠 ✅ Note your drawing should now contain both the LED and the Button!
Take a picture of the wiring diagram and mail it to yourself. Add this picture file (.jpg or .png) from your laptop to your laptop to the rPI’s JupyterLab. Add a link to this picture inside the Wiring diagram Markdown cell created for you by adding a single line similar to:

Wire-up your RPI following your own hand-drawn diagram above. Ensure that the code in button_test.ipynb LED setup block and the Button setup block correctly reflects the GPIO pins you used for the LED and Button.
Note that we have added a callback function for the button called pressed in the BUTTON setup block. We will walkthrough this code together. The MAIN loop block remains the same as before, although the LED is blinking faster!
Run the button_test.ipynb notebook. Your notebook should like the image below. Click the restart & runall button as before to Run your notebook. Only one user can run the notebook a time!
Now you will see that both the LED and Button are functional, except they are NOT linked to each other. This will be the purpose of the next step.
🟠 ✅ Did you make a new wiring diagram and make changes to the Jupyter Notebook ?? If not, please do this as it is part of your assessment!
🟠 ✅ Does it work ? If not, please debug with your partner by looking at the wiring diagram, and code. If this fails, call me or the TA to assist you
To create this notebook we will combine the Button capability to turn on or turn off the LED. This means that the button needs to behave like a toggle switch.
There are NO wiring changes needed. You can use the same wiring diagram and breadboard setup as before.
Download the toggle_led.ipynb by right-clicking this link and select ‘Save Link As’ and then drag the toggle_led.ipynb file to your laptop to the rPI’s JupyterLab.
Open the toggle_led.ipynb by double-clicking on it in JupyterLab. Your challenge is to modify inside the MAIN loop block underneath the While True: and add to make it work. Note the global keyword before the button_state variable in the function pressed(). Why is that necessary?
if button_state:
# some code ..
else:
# some code ..
Run the toggle_led.ipynb
🟠 ✅ Does it work ? If not, please debug with your partner by looking at the wiring diagram, and code. If this fails, call me or the TA to assist you
To create this game, we will download the reaction_game.ipynb by right-clicking this link and select ‘Save Link As’ and then drag the reaction_game.ipynb file to your folder in the rPI’s JupyterLab.
You will need to add a second button as shown in the code you brought in. Create a wiring diagram based on the code that you see.
Create a wiring diagram including you second button. In this diagram, there needs to be 1 LED and 2 Buttons wired up. Take a picture of the wiring diagram and mail it to yourself. Add this picture file (.jpg or .png) from your laptop to your laptop to the rPI’s JupyterLab. Add a link to this picture inside the Wiring diagram Markdown cell created for you by adding a single line similar to:

🟠 ✅ Did you make a new wiring diagram and make changes to the Jupyter Notebook ?? If not, please do this as it is part of your assessment!
Add the second Button to your Breadboard. Once circuit is wired according to the code, two of you can play this game to see who has the fastest finger in the West! Seek help if you cannot get it to work.
🟠 ✅ Did the game work ? If not, please debug with your partner by looking at the wiring diagram, and code. If this fails, call me or the TA to assist you
Modify the game to code to handle an EVEN number of rounds (Game could be tied in this case and there should be no winners).
🟠 ✅ Did your modifications work ? The game should still work if there is an even number of rounds and should declare a Tie and no winners.
Modify the game to code to handle a fixed number of button presses. If a player exceeds this number, they other player should be immediately declared the winner and the program should exit. To exit the program, you will use the exit() method which will have to imported fron the ‘sys’ library. You will need an import statement for that. You will also need to add counters for each button click for each player for accounting.
🟠 ✅ Did your modifications work ? The game should immediately tewrminate if a player exceeds the allowed amount of button presses.