276°
Posted 20 hours ago

MAKERFACTORY 15045 Advent Calendar for Raspberry Pi

£9.9£99Clearance
ZTS2023's avatar
Shared by
ZTS2023
Joined in 2023
82
63

About this deal

With the first day’s box giving you a new pre-soldered Raspberry Pi Pico H, Micro-USB cable and a couple of breadboards, all you need is a compatible computer (with a full-size USB port) to plug it into - a Windows PC, Mac or Linux machine (sorry, Chromebooks are not suitable). Another handy feature we can use with GPIO pins is ' toggle'. As you might have guessed, this toggles a pin's status from HIGH to LOW to HIGH and so on.

Today we're going to be setting up our motion sensor then testing it by moving our bodies. Then, similar to some of the previous boxes, we'll combine this with other components to create fun little projects including our own little alarm system with a new function to learn! Construct the Circuit We're going to explain those pins in a few moments, but for now let's get the circuit built. Construct the Circuit Argumentsare optional in functions. They allow you to pass information intoyour function, if needed. We pass the information to the function when we callit - that might be a bit confusing so let's jump to an example so you can see it working. The Pico comes with a little LED onboard, which is attached to one of the Pico’s RP2040 pins, GPIO25. This pin isn't one of the physical pins available around the edge of the board. You’ll have already noticed that the first box is larger than most of the others. This is to give everything you need to build the foundations for the fun projects you’ll be making over the next 12 days. Box #1 ContentsWe now need to install the MicroPython firmware on the Raspberry Pi Pico. This gives the Pico the basic software it needs to run MicroPython code that we'll send to it later. Now grab the jumper wires. You need one wire connecting the blue channel to a Ground pin on your Pico – we suggest using physical pin 38 like we’ve done in the diagram below (remember to refer to the Pico pinout if you need a reminder). The else statement says " if none of the statements above have their conditions met, do this instead". It can be useful if you want something to always happen when none of the above if/elif statements are being met. We're using a pull down here to ensure the sensor is LOWunless triggered, because we don't want that pin floating between the two (as we covered in day #3). We're using Windows (11) in the example projects using the Thonny IDE. Thonny is also available for MAC and Linux machines and there should be very little difference from the instructions. Chromebooks are not supported.

The way we're going to wire our potentiometer allows us to use it to send a varying voltage value to our Raspberry Pi Pico, which some special pins can read, convert and provide a value we can use in our projects. Grab your potentiometer, slide the flat washer over the dial and then screw on the included nut (these may already be fitted). play_effect(starting_note,finishing_note,note_decrement,note_length,note_separation,blast_length) #play the effectIt doesn't matter which side of the LED the resistor sits , as long as it's there limiting the flow of current for the entire circuit ( take a look at the comment section for an example ). Raspberry Pi Pico Pin Map

The code uses everything we have learned up to now with the addition of some functions from the time library to do accurate timing to the millisecond and also using the random number library to keep you guessing when the start lights will go out (clue – it will never be more than six seconds). Whilst we only use the delay once in the example below, we thought it was still a nice opportunity to show you another way of using variables to save you time and improve your code. The Code You also need to connect the right leg of each LED leg to a GPIO pin. Use GPIO18 (physical pin 24) for Red, GPIO19 (physical pin 25) for Amber, and GPIO20 (physical pin 26) for Green, like the diagram below. We'll be using the potentiometer from yesterday's box to control our buzzer in a few moments, so leave your circuit in place as it is. We just need to add our buzzer and we're good to go. If the button is pressed and a signal is sent to that pin, our code will print " button 1 pressed".reading = potentiometer.read_u16() # Read the potentiometer value and set this as our reading variable value

def play_effect(starting_note,finishing_note,note_decrement,note_length,note_separation,blast_length): Here’s a simplifiedmap of the pins on the Pico (known as a ‘ pinout’) to help you with the next steps and the rest of the calendar. We have included a 50/50 split between blinky components and control components (we alternate each day)Now to add your motion sensor. Just to note, the diagrams below also use a generic motion sensor part from Fritzing as there is currently no part for the mini version in your box. The wiring is the same. The holes in the middle are connected in vertical lanes, with each lane having 5 connected pins either side of the divider. The divider stops both sides connecting together. The Circuit

Asda Great Deal

Free UK shipping. 15 day free returns.
Community Updates
*So you can easily identify outgoing links on our site, we've marked them with an "*" symbol. Links on our site are monetised, but this never affects which deals get posted. Find more info in our FAQs and About Us page.
New Comment