Catwheel

Catwheel

We love furballs here at The MagPi, and this giant hamster-style wheel for exercising cats is a strong contender for our ‘pet project of the year’ award. Jasper and Ruben are two cool cats, with an even cooler owner (who doesn’t want to be named). “[It’s] the same as a hamster wheel,” says Jasper’s owner. “They can run and walk on it whenever they please.” The proportions are a bit different: whereas most hamsters wheels are roughly twice the height of a hamster, this cat wheel is about three times a cat’s height. The full article can be found in The MagPi 45 and was written by Lucy Hattersley “The Raspberry Pi gets triggers from an electromagnetic sensor attached to the frame,” he tells us. There are “six small nails under the lining on the back of the wheel, serving as actuators. Based on these triggers, activity on the wheel can be detected, and the speed is calculated.” The Raspberry Pi monitors the sensor using a GPIO port and on every trigger, the current speed is calculated. Jasper and Ruben were lured onto the wheel using cat treats. “We first let them get used to the wheel’s movement, as standing on it causes it to swing. Then we just held the treats a little higher so they’d have to start walking to get near them. We’d reward them when walking by actually giving them the cat treat and some additional attention, which is what it’s all about for them.” The final wheel in all its glory Both cats are now used to the wheel, and they’ve been using it for a long time. “They both do,” says Jasper’s owner, “at least twice a day, any time, night or day. Preferably when somebody is admiring them. They walk on it at about 3km/h and travel distances of over 250 metres,” he continues, “often taking several short breaks, which are mostly caused by distraction. Sometimes they take a sprint, usually peaking at 8km/h. Overall, they perform equally – if there’s a speed difference, it’s too small to notice.” The build itself is also impressive. “The rear disc is a plywood plank, the cylinder is galvanised steel, and the surface of the entire wheel is covered in car lining. The entire frame is made of stainless steel, offering stability and necessary counterweight. He tells us it was a relatively easy project. “The only problem…
Source: Catwheel

Drum HAT review

Drum HAT review

A while ago we came across the Piano HAT, a snazzy piece of hardware based on Zachary Igielman’s PiPiano and turned into a HAT (hardware on top) device by Pimoroni. The full article can be found in The MagPi 45 and was written by Lucy Hattersley The Drum HAT is its funky brother, capable of quickly transforming a Raspberry Pi into a drum machine. On top of the board sit eight capacitive sensor pads; you tap the beat out with your fingers. Each pad also sports an LED that lights up when you tap (or can be programmed separately). Installation is easy thanks to a command listed on the Drum HAT’s GitHub page. Just enter curl -sS get.pimoroni.com/drumhat | bash to get started. This script installs the Python modules and downloads a bunch of sample WAV files and programs Enter python drums.py and you’ll quickly have a drum machine ready to play. A file called direct.py links the samples in the drums2 folder, and you can edit the Python code to link to any folder you want. Then it’s just a case of creating some drum samples, or downloading sample files from a site like looperman.com. Amen to that We started by recreating ‘Boots and Cats’ using our sampled voices, then grabbed a bunch of samples of the ‘Amen Break’ and set to turning a Raspberry Pi into a kick-ass drum-and-bass machine. Taking apart the sample code (and reading the GitHub page) enabled us to figure out the Drum HAT code. You can set the pads to react when hit, or released, and you can get the pads to call a function that can do anything. Building a drum machine is where it’s at, though, and we had an awesome amount of fun with the Drum HAT (much more than with the seemingly more complex Piano HAT). A good project to try out. Last word 4/5 Easy to set up and fun to bash around on, the Drum HAT turns a Raspberry Pi into a home-made 808 drum machine. The post Drum HAT review appeared first on The MagPi Magazine.
Source: Drum HAT review

Sense HAT science: humidity

Sense HAT science: humidity

In the past, we used the Sense HAT to investigate some of the properties of light and measure atmospheric pressure. This time, we’re going to experiment with another of the environmental sensors, and take a look at humidity and the things that can influence it. The full article can be found in The MagPi 45 and was written by Richard Hayler You’ll need A Sense HAT twoDigits Python library Some resealable sandwich bags, drinking straws, and sticky tape Crew Detector code Raspberry Pi Camera Module Attach the Sense HAT to your Pi and power it up. Open IDLE3 or just type python3 in a terminal window, and then import the SenseHat library and connect to the board:from sense_hat import SenseHat sh = SenseHat()As with pressure measurements, we can take a humidity reading with a single line:sh.get_humidity()This should produce a number like 32.87158203125 (if you just get 0 back, run the command again). What does this number mean? A simple way to think of humidity is that it’s the amount of water vapour in the air. However, there are different ways of measuring humidity. Absolute humidity is the water content of air at a certain temperature and is normally measured in grams/m3 , whereas relative humidity is the amount of moisture in the air compared to what the air can ‘hold’ at that temperature, given as a percentage. The Sense HAT reports relative humidity; this is useful for weather forecasting as the higher the value, the greater chance of precipitation (rain, dew, or fog). To make it easier to move around and measure differences in humidity, let’s make our Pi portable. Making a sensor From last issue, you’ll probably remember that the standard units for pressure are millibars, and normal values tend to be at least three or four digits long. Therefore, when displaying our measurements, we had to scroll them across the LED matrix. This time, we can easily round our humidity values to the nearest integer percent, because we should normally expect the readings to be 0-99%. Two digits is an ideal size for displaying a number on the LED matrix, and we’ve written a handy Python module that makes it simple. You can install it by typing this at the command line:sudo pip-3.2 install twoDigitOnce that’s done, download or type up the code from the listing, then start the program running by typing:python3 humidity.pyNow disconnect the mouse, keyboard,…
Source: Sense HAT science: humidity

Pi Moon Camera

Pi Moon Camera

Shooting the moon has been an obsession of James Mitchell’s for a very long time. After several failed attempts to get a clear photo from various cameras and lenses over the years, he decided “on a bit of a whim” to give it a go with a Raspberry Pi Camera Module. The full article can be found in The MagPi 45 and was written by Lucy Hattersley “I have been working on pushing the limits of the Pi camera for a while,” James tells us. One of his first pictures was a long exposure of a Lego figure, which won him the runner-up prize in an Adafruit competition. “I wanted to use my lenses to improve on that.” The lens adapter is 3D printed and allows you to use DSLR lenses with the Pi camera After discovering a design for a Canon lens adapter for the Pi by Charmlee, James got a 3D print made at his local Berlin printing cafe and was impressed: “Everything simply slots together. Actually quite a nice design, to be honest, but it only works with Canon EF (EOS) lenses.” He soon realised that using the adapter with the Pi Camera Module requires the removal of the latter’s tiny stock lens. “It really is simple… it just screws off. What might be considered difficult is that it has a little glue inside to stop it from moving. So I used a couple of pairs of pliers to remove it.” While this did buff the plastic slightly, the lens can go back on to protect the sensor when storing the camera. The Pi camera sensor can then be inserted into the 3D printed adapter, enabling it to be exposed directly to light coming through the attached Canon lens. Since the sensor only captures a small section of what the lens can see, it does so with 5 megapixels’ worth of detail. This led James to try shooting a full moon from his Berlin balcony, using a 78-300mm lens, which resulted in a surprisingly detailed image of the cratered lunar surface. All the kit necessary to take some moon photos Asked what camera settings he used, James replies, “I’m embarrassed to say I left it on auto. In fact, the command I used had no modifiers at all – raspistill -o moon.jpg. What I got really was a happy accident. Could I improve the picture with changing…
Source: Pi Moon Camera

Sonic Pi – sample slicing

Sonic Pi – sample slicing

Way back in part three of this Sonic Pi series, we looked at how to loop, stretch, and filter one of the most famous drum breaks of all time: the Amen Break. In this tutorial, we’re going to take this one step further and learn how to slice it up, shuffle the slices, and glue it back together in a completely new order. If that sounds a bit crazy to you, don’t worry: it will all become clear and you’ll soon master a powerful new tool for your live‑coded sets. The full article can be found in The MagPi 45 and was written by Sam Aaron Sound as data Before we get started, let’s just take a brief moment to understand how to work with samples. By now, you have all hopefully played with Sonic Pi’s powerful sampler. If not, there’s no time like the present! Boot up your Raspberry Pi, launch Sonic Pi from the Programming menu, type the following line into a fresh buffer, and then hit the Run button to hear a pre-recorded drum beat:sample :loop_amenA recording of a sound is simply represented as data: lots of numbers between -1 and 1, which represent the peaks and troughs of the sound wave (see the boxout to the right for more information). If we play those numbers back in order, we get the original sound. However, what’s to stop us from playing them back in a different order and creating a new sound? How are samples actually recorded? It’s actually pretty simple once you understand the basic physics of sound. When you make a sound – for example, by hitting a drum –the noise travels through the air in a similar fashion to the way the surface of a lake ripples when you throw a pebble into it. When those ripples reach your ears, your eardrum moves sympathetically and converts those movements into the sound you hear. If we wish to record and play back the sound, we therefore need a way of capturing, storing, and reproducing those ripples. One way is to use a microphone, which acts like an eardrum and moves back and forth as the sound ripples hit it. The microphone then converts its position into a tiny electric signal, which is then measured many times a second. These measurements are then represented as a series of numbers between -1 and 1. If we were to…
Source: Sonic Pi – sample slicing

Wyliodrin STUDIO review

Wyliodrin STUDIO review

Wyliodrin STUDIO is a Chrome App development suite that enables developers to take a board, like our beloved Raspberry Pi, and quickly prototype an IoT device. The full article can be found in The MagPi 45 and was written by Lucy Hattersley Setup is a breeze: installation is via disk image and from that point on, everything takes place from Chrome on another computer. You can still use the Wyliodrin website, which has new features, but what we’re really interested in is the Wyliodrin STUDIO Chrome Web Store app. Got a visual Wyliodrin supports JavaScript and Python, but the entry point is Visual Programming, a beefed-up version of Google’s Blockly. Programs are arranged, like Scratch, by dragging and dropping blocks together. It’s much more powerful than either Scratch or Blockly, with blocks for everything from social media to humidity sensors and accelerometers. There are blocks for GoPiGo, Lego Mindstorms, and Grove sensors. You can even set up a web server using blocks. The blocks are converted to Python code on the fly, and you can move back and forth between Visual Programming and Python. It’s easy to be sniffy about using blocks when you’ve taken the time to learn Python or Java, but it’s impossible to make a syntax error. Therefore, you can focus on the logic, and we find slotting blocks together a fun way to get inspiration. There are limitations (it doesn’t scale up particularly well), but you can always move your project over to Python. In a dash The other side of Wyliodrin is the Dashboard, which features an array of graphs, charts, dials, buttons, and sliders – everything you need to visually interact with your Raspberry Pi. There is a great range of example programs included, and some powerful tutorials to follow. Wyliodrin STUDIO doesn’t have the limitations of the browser-based service, and you can add as many projects and Dashboard widgets as you want. Note that the contract states that it’s for personal and educational use only. We’re impressed with Wyliodrin STUDIO. It’s a solid IDE that’s easy to set up, with no real restrictions. Visual Programming is a great way to demystify the often enigmatic nature of IoT prototyping, and there are some great tutorials available. Last word 5/5 A solid springboard to start building your internet-based projects. Visual Programming is a fun way to get started, but you’re not limited in scope. The…
Source: Wyliodrin STUDIO review

New Pi Zero, now with added camera port

New Pi Zero, now with added camera port

A few weeks ago it was teased that a new Pi Zero was coming with an oft-requested feature for the tiny computer. This morning at 9 AM on the dot UK time, this new v1.3 of the Pi Zero was released with a pint-sized CSI connector that allows you to connect the Raspberry Pi Camera Module. The best part? It still costs the same at $5. Unlike the other models of Raspberry Pi, the connector for the camera is on the edge of the board and the ribbon is connected on this side rather than at the top. This keeps the profile of the Pi Zero very low and makes for an interestingly different orientation for the camera which should be useful in some projects. The new cable plugs in the side rather than at the top In a blog post by Eben Upton himself, he explains how by pure luck that a connector used on the compute module IO board just fit onto the side of the Pi Zero between the mount holes. This does mean you’ll need a new ribbon cable for the camera module though, although they cost roughly the same price of the Pi Zero itself ($5/£4) and they’re extremely easy to install. This also means the Pi Zero is back in stock! You can buy it with the new camera connector from The Pi Hut, Pimoroni, Adafruit, and in-store at a Micro Center. The adapter cables can also be found on these sites as well. Interested in what to do with the camera once you get it? The last issue of The MagPi was a camera special and had plenty of projects to try out. Happy snapping! The post New Pi Zero, now with added camera port appeared first on The MagPi Magazine.
Source: New Pi Zero, now with added camera port

BURT bot

BURT bot

Raspberry Pi Zero robots are hardly new – in fact, in our Pi Zero launch issue (#40) we featured a fully functional Raspberry Pi Zero robot before the board was even out! The thing we like best about Pi Zero robots is that they’re always quite inventive and different (such as the Matchbot), and BURT is no different. The full article can be found in The MagPi 44 Created by Average Man himself Richard Saville, BURT stands for Boxey Unintelligent Robot with Tracks. “I had attended Pi Wars back in December with my other robot, ‘AverageBot’,” Richard tells us. “When the new Pi Zero came out, I wanted to try my hand at making a mini robot using the things I had learnt through Pi Wars.” The BURT is controlled by remote It’s a remote-controlled device, so not truly autonomous, but it’s still an excellent little project. BURT comprises a custom-designed plywood chassis that can be rapidly revised and remade, a custom PCB ‘face’ with a couple of LEDs that react to the movement of the robot, and a series of motors. Motor drivers and remote controls finish off the robot to make it work. “It’s not complex at all in terms of features,” Richard points out. “BURT has no sensors or anything clever – simply two motors and basic controls (hence the ‘Unintelligent’ part of the BURT name). The complex part is putting it all together and working out where everything can go, whilst trying to maintain a small footprint. Everything is compact and fiddly, but that was always the aim.” BURT is still a work in progress, but Richard seems happy with the way it has turned out so far: “I aimed to make a small basic robot that could move around; that part works as intended, and the media centre remote control does the job well. BURT seems to be able to negotiate a range of different terrains with ease.” Some of Richard’s plans to upgrade BURT should help to make it more autonomous. First on the agenda is to try to add a line sensor, much like the CamJam EduKit robot. The current power source, a series of AAA batteries, doesn’t last very long either, so he’s considering replacing it with a rechargeable LiPo one: “LiPo batteries still scare me a bit after seeing some videos of them ‘going bad’, but I may give it a…
Source: BURT bot

RCA output on a Pi Zero

RCA output on a Pi Zero

In this simple, easy-to-follow tutorial, we’ll be showing you how to hook up your Pi Zero to a TV via an RCA cable. That’s right – believe it or not, the Pi Zero isn’t limited to just HDMI video. By soldering a header pin, hooking up a couple of jumper wires, and adding a screw terminal RCA connector, you can easily access the RCA video output so you can use an old CRT TV in your next Raspberry Pi project. The full article can be found in The MagPi 44 We’re going to be soldering two pin headers onto the Pi Zero. Start by soldering a pin header to the square pad labelled ‘TV’ on your Pi, then solder another header onto the circle pad next to the square pad. Both pads are contained within a white outline. See image below for reference. The pins need to be soldered here to use the composite video out You could solder wires directly to these pins, but by using pin headers you get a nice neat solution that allows your connection to be removed when required. Once the headers have been soldered to your Pi, you can then move on to attaching the jumper wires to your RCA screw terminal. Using the male side of the jumper wire, attach them to each of the terminals, making sure to screw them up nice and tight. Make a note of which wire is plugged into the positive pin and negative pin. Now plug each of the wires into the pin headers you previously soldered onto your Pi. Make sure the wire connected to the positive terminal is connected to the pin labelled ‘TV’. That’s it for setting up the hardware. Now your Pi should automatically detect which video method you’re using, either HDMI or RCA. If it doesn’t, however, read on and follow our software configuration to get it working. Setting up the software First things first: either SSH into your Raspberry Pi, or open up a terminal window. We need to make some changes to the config.txt file, but before we do that it’s probably a good idea to make a backup of the original, just in case: sudo cp /boot/config.txt /boot/config.txt_backupNow we have our backup, we can edit the original and make some changes. Start by opening config.txt in your editor of choice. We’ll be using nano:sudo nano /boot/config.txtThere are two lines…
Source: RCA output on a Pi Zero

Add RCA output to a Pi Zero

Add RCA output to a Pi Zero

In this simple, easy-to-follow tutorial, we’ll be showing you how to hook up your Pi Zero to a TV via an RCA cable. That’s right – believe it or not, the Pi Zero isn’t limited to just HDMI video. By soldering a header pin, hooking up a couple of jumper wires, and adding a screw terminal RCA connector, you can easily access the RCA video output so you can use an old CRT TV in your next Raspberry Pi project. The full article can be found in The MagPi 44 We’re going to be soldering two pin headers onto the Pi Zero. Start by soldering a pin header to the square pad labelled ‘TV’ on your Pi, then solder another header onto the circle pad next to the square pad. Both pads are contained within a white outline. See image below for reference. The pins need to be soldered here to use the composite video out You could solder wires directly to these pins, but by using pin headers you get a nice neat solution that allows your connection to be removed when required. Once the headers have been soldered to your Pi, you can then move on to attaching the jumper wires to your RCA screw terminal. Using the male side of the jumper wire, attach them to each of the terminals, making sure to screw them up nice and tight. Make a note of which wire is plugged into the positive pin and negative pin. Now plug each of the wires into the pin headers you previously soldered onto your Pi. Make sure the wire connected to the positive terminal is connected to the pin labelled ‘TV’. That’s it for setting up the hardware. Now your Pi should automatically detect which video method you’re using, either HDMI or RCA. If it doesn’t, however, read on and follow our software configuration to get it working. Setting up the software First things first: either SSH into your Raspberry Pi, or open up a terminal window. We need to make some changes to the config.txt file, but before we do that it’s probably a good idea to make a backup of the original, just in case: sudo cp /boot/config.txt /boot/config.txt_backupNow we have our backup, we can edit the original and make some changes. Start by opening config.txt in your editor of choice. We’ll be using nano:sudo nano /boot/config.txtThere are two lines…
Source: Add RCA output to a Pi Zero