Author Archives: Alex Bate

Connect your Raspberry Pi 4 to an iPad Pro

via Raspberry Pi

Have you ever considered attaching your Raspberry Pi 4 to an Apple iPad Pro? How would you do it, and why would you want to? Here’s YouTuber Tech Craft to explain why Raspberry Pi 4 is their favourite iPad Pro accessory, and why you may want to consider using yours in the same way.

We’ve set the video to start at Tech Craft’s explanation.

My Favourite iPad Pro Accessory: The Raspberry Pi 4

The Raspberry Pi 4 is my favourite accessory to use with the iPad Pro. In this video, learn more about what the Pi can do, what gear you need to get running with one, how to connect it to your iPad and what you’ll find it useful for.

 

Having installed Raspbian on Raspberry Pi and configured the computer to use USB-C as an Ethernet connection (read Ben Hardill’s guide to find out how to do this), Tech Craft could select it as an Ethernet device in the iPad’s Settings menu.

So why would you want to connect your Raspberry Pi 4 to your iPad? For starters, using your iPad instead of a conventional HDMI monitor will free up desk space, and also allow you to edit your code on the move. And when you’ve connected the two devices like this, you don’t need a separate power lead for Raspberry Pi, because the iPad powers the computer. So this setup is perfect for train or plane journeys, or for that moment when your robot stops working at a Raspberry Jam, or for maker conventions.

You can also use Raspberry Pi as a bridge between your iPad and portable hard drive, for disk management.

Tech Craft uses the SSH client Blink to easily connect to their Raspberry Pi via its fixed IP address, and with Juno Connect, they connect to a running Jupyter instance on their Raspberry Pi to do data science work.

For more information on using Raspberry Pi with an iPad, make sure you watch the whole video. And, because you’re a lovely person, be sure to subscribe to Tech Craft for more videos, such as this one on how to connect wirelessly to your Raspberry Pi from any computer or tablet:

Mobile Raspberry Pi with ANY iPad. No USB-C needed.

Following on my from earlier video about pairing the Raspberry Pi 4 with the iPad Pro over USB-C, this video show how to pair any iPad (or iPhone, or Android tablet) with a Pi4 or a Pi3 over WiFi.

The post Connect your Raspberry Pi 4 to an iPad Pro appeared first on Raspberry Pi.

Protect your veggies from hail with a Raspberry Pi Zero W

via Raspberry Pi

Tired of losing vegetable crops to frequent summertime hail storms, Nick Rogness decided to build something to protect them. And the result is brilliant!

Digital Garden with hail protection

Tired of getting your garden destroyed by hail storms? I was, so I did something about it…maker style!

“I live in a part of the country where hail and severe weather are commonplace during the summer months,” Nick explains in his Hackster tutorial. “I was getting frustrated every year when my wife’s garden was get demolished by the nightly hail storms losing our entire haul of vegetable goodies!”

Nick drew up plans for a solution to his hail problem, incorporating liner actuators bolted to a 12ft × 12ft frame that surrounds the vegetable patch. When a storm is on the horizon, the actuators pull a heavy-duty tarp over the garden.

Nick connected two motor controllers to a Raspberry Pi Zero W. The Raspberry Pi then controls the actuators to pull the tarp, either when a manual rocker switch is flipped or when it’s told to do so via weather-controlled software.

“Software control of the garden was accomplished by using a Raspberry Pi and MQTT to communicate via Adafruit IO to reach the mobile app on my phone,” Nick explains. The whole build is powered by a 12V Marine deep-cycle battery that’s charged using a solar panel.

You can view the full tutorial on Hackster, including the code for the project.

The post Protect your veggies from hail with a Raspberry Pi Zero W appeared first on Raspberry Pi.

How to control multiple servo motors with Raspberry Pi

via Raspberry Pi

In the latest Explaining Computers video, Christopher Barnatt explains how to use servo motors with Raspberry Pi. Using servos is a great introduction to the digital making side of computing; servos allow you to control the movement of all manner of project components with your Raspberry Pi and a motor controller attached to its GPIO pins.

Raspberry Pi Servo Motor Control

Control of SG90 servos in Python on a Raspberry Pi, including an explanation of PWM and how a servo differs from a motor. You can download the code from the video at: https://www.explainingcomputers.com/pi_servos_video.html The five-pack of SG90 servos used in this video was purchased on Amazon.co.uk here: https://www.amazon.co.uk/dp/B07H9VC698/ref=nosim?tag=explainin-21 with a similar product on Amazon.com here: https://amzn.to/2QHshx3 (affiliate links).

Servos and your Raspberry Pi

Christopher picked up his SG90 servo motors online, where you’ll find a variety of servo options. What type of servo you need depends on the project you want to create, so be sure to consider the weight and size of what you plan to move, and the speed at which you need to move it.

As the motor controller connects via GPIO, you can even use the tiny £5 Raspberry Pi Zero to control your servo, which makes adding movement to your projects an option even when you’re under tight space constraints.

Find out more

For other detailed computing videos, be sure to subscribe to the Explaining Computers YouTube channel.

And for more Raspberry Pi projects, check out the Raspberry Pi projects page.

Raspberry Pi projects PSA

We’re always looking for people to join our incredible community of translators to help us translate our free resources, including the free projects found on our projects page.

If you speak English and another language and would like to give a portion of your time to making our resources available to more people across the globe, sign up as a translator today.

The post How to control multiple servo motors with Raspberry Pi appeared first on Raspberry Pi.

Playing The Doors with a door (and a Raspberry Pi)

via Raspberry Pi

Floyd Steinberg is back with more synthy Raspberry Pi musical magic, this time turning a door into a MIDI controller.

I played The Doors on a door – using a Raspberry PI DIY midi controller and a Yamaha EX5

You see that door? You secretly want that to be a MIDI controller? Here’s how to do it, and how to play a cover version of “Break On Through” by The Doors on a door ;-) Link to source code and the DIY kit below.

If you don’t live in a home with squeaky doors — living room door, I’m looking at you — you probably never think about the musical potential of mundane household objects.

Unless you’re these two, I guess:

When Mama Isn’t Home / When Mom Isn’t Home ORIGINAL (the Oven Kid) Timmy Trumpet – Freaks

We thought this was hilarious. Hope you enjoy! This video has over 60 million views worldwide! Social Media: @jessconte To use this video in a commercial player, advertising or in broadcasts, please email kyle@scalemanagement.co

If the sound of a slammed oven door isn’t involved in your ditty of choice, you may instead want to add some electronics to that sweet, sweet harmony maker, just like Floyd.

Trusting in the melodic possibilities of incorporating a Raspberry Pi 3B+ and various sensory components into a humble door, Floyd created The Doors Door, a musical door that plays… well, I’m sure you can guess.

If you want to build your own, you can practice some sophisticated ‘copy and paste’ programming after downloading the code. And for links to all the kit you need, check out the description of the video over on YouTube. While you’re there, be sure to give the video a like, and subscribe to Floyd’s channel.

And now, to get you pumped for the weekend, here’s Jim:

The Doors – Break On Through HQ (1967)

recorded fall 1966 – lyrics: You know the day destroys the night Night divides the day Tried to run Tried to hide Break on through to the other side Break on through to the other side Break on through to the other side, yeah We chased our pleasures here Dug our treasures there But can you still recall The time we cried Break on through to the other side Break on through to the other side Yeah!

The post Playing The Doors with a door (and a Raspberry Pi) appeared first on Raspberry Pi.

Design 3D prints with a Raspberry Pi and BlocksCAD

via Raspberry Pi

BlocksCAD is a 3D model editor that you use in a web browser, and it runs on Raspberry Pi. You drag and drop code blocks to design 3D models that can be exported for 3D printing.

In this project, you will use BlocksCAD to design a 3D pendant. The pendant uses a geometric pattern based on ‘the flower of life’, a design which is often found in historical art.

The finished pendant with a cord threaded through the small hanging hoop

If you have access to a 3D printer, then you can print your pendant. The pendant is small and only uses a little bit of filament. There’s a hoop on top of the pendant so that you can put it on a necklace or cord. The pendant has a diameter of 40 mm, plus the hoop for hanging. It is 2 mm thick, so it will 3D-print quite quickly.

After this project, you’ll also be able to code your own design and create a custom pendant.

Step 01: create a hoop

This project can be completed in a web browser using BlocksCAD. Open Chromium and enter the BlocksCAD editor URL: blockscad3d.com/editor.

The design uses six interlocking hoops in the centre, and a larger hoop around the outside. As mentioned, the pendant is 40 mm wide, plus the hoop for hanging, which is 2 mm thick.

Click 3D Shapes and drag a cylinder block to the project. Create a cylinder with a radius of 12, and a height of 2 (the unit here is millimetres). Cylinders are automatically centred along the X and Y axes. Select not centered so that the pendant sits on the surface. (This means that the Z-axis value is greater than 0.)

Click on the Render button after each change to your code to see the results.

Step 02: add more hoops

Now, drag a difference block from Set Ops to encase the cylinder. Add another cylinder block in the bottom space, and this time give it a radius of 11 mm. This will remove a smaller cylinder from the centre. This creates a hoop. Click Render again to see it.

If you like, you can click on the coloured square to change the colour used in the viewer. This does not affect the colour of your pendant, as that depends on the colour of the filament that you use.

The design uses six intersecting hoops, and each hoop is moved out from the centre and rotated a different number of degrees.

In the final design, there is no central hoop: the hoops are all moved out from the centre.

Drag a translate block (from Transforms) around your code, and set X and Y to 5. This moves the first hoop into position.

Step 03: centre the hoop

Now the hoop is a little off-centre. You need multiple copies of this hoop, rotated around the centre. First, create three equally spaced hoops.

Add a count Loops block to create three hoops. To space the hoops, add a rotate Transforms block between the count loop and the translate block.

In the count block, set the i variable from 1 to 3. You’ll need to insert an arithmetic block from Math and a variable (i) block from Variables into the Z field of the rotate block.

The rotation moves each hoop by 120 × i degrees, so that the three hoops are distributed equally around the 360 degrees of a circle (360 / 3 = 120). Look at the code and make sure you understand how it works. The finished design has six hoops rather than three. In the count block, set i from 1 to 6, and set the Z rotation to 60, so it creates six equally spaced hoops.

Step 04: add a border

Next, add a border around the edge of the design. Create a centred hoop that touches the edges of the design. You can either do the maths to work out what the radius of the circle needs to be, or you can just create a circle and change the radius until it works. Either approach is fine!

Encase your code with a union block from Set Ops, to join the border to the other hoops. Add a difference block to the plus section of union, and two cylinder blocks to make the hoop.

The six hoops each have a radius of 12 mm, so the border cylinder that you are making needs to be bigger than that. You could try setting the radius to 24 mm.

To make a hoop, the radius of the second cylinder in the difference block needs to be 1 mm smaller than the radius of the first cylinder.

Adjust the size of the cylinders until the border hoop just touches the outer edges of the six inner hoops.

The radius should be around 20 mm. (As mentioned in the introduction, the finished pendant will be 40 mm in diameter.)

Step 05: work it out

You could also use maths to work out the diameter. The diameter of each inner hoop is 24 mm. If the hoops met at the centre of the pendant, the border hoop would need to have a radius of 24 mm. But the inner hoops overlap, as they are translated 5 mm along the X and Y axes.

This removes a section from the radius. This section is on the arc, 5 mm from the origin, so we need to remove 5 mm from 24 mm. Thus the inner radius of the border hoop should be 19 mm.

Maths is really useful when you need to be accurate. But it’s fine to just change things until you get the result you need.

Step 06: add a hanging hoop

Now, add a small hanging hoop through which you can thread a cord to make a necklace.

Click the [+] on the union block to add another section to add the new hoop.

At the moment, the position of the hanging hoop isn’t very visually pleasing.

Add a rotate block to move the inner hoops so that the hanging hoop is centred over one of the gaps between them.

Step 07: experiment with shapes

Experiment and change some values in your pendant. For example, change the number of hoops, or the rotation.

You could also try to use cuboids (cubes) instead of cylinders to create a pattern.

Step 08: export to STL

BlocksCAD 3D can export an STL file for 3D printing. Render your model and then click on Generate STL. Remember where you save the STL file. Now 3D-print your pendant using a filament of the colour of your choice. Very carefully remove the 3D print from the print bed. The pendant is thin, so it’s quite delicate.

You might need to remove small strands of filament (especially from the hanging hoop) to tidy up the print.

Thread the pendant on to a chain or cord. If you want to use a thicker cord or necklace, then you can adjust the design to have a larger hanging hoop.

Check your code

You can download the full code and check it against your own. You can also check out our projects page, where you’ll find more images and step-by-step instructions for using BlocksCAD.

This project was created by Dr Tracy Gardner and the above article was featured in this month’s issue of The MagPi magazine. Get your copy of The MagPi magazine issue 89 today from your local newsagent, the Raspberry Pi Store, Cambridge, or online from Raspberry Pi Press.

The post Design 3D prints with a Raspberry Pi and BlocksCAD appeared first on Raspberry Pi.

How to set up OctoPrint on your Raspberry Pi

via Raspberry Pi

If you own a 3D printer, you’ll likely have at least heard of OctoPrint from the ever benevolent 3D printing online community. It has the potential to transform your 3D printing workflow for the better, and it’s very easy to set up. This guide will take you through the setup process step by step, and give you some handy tips along the way.

Octoprint

Before we start finding out how to install OctoPrint, let’s look at why you might want to. OctoPrint is a piece of open-source software that allows us to add WiFi functionality to any 3D printer with a USB port (which is pretty much all of them). More specifically, you’ll be able to drop files from your computer onto your printer, start/stop prints, monitor your printer via a live video feed, control the motors, control the temperature, and more, all from your web browser. Of course, with great power comes great responsibility — 3D printers have parts that are hot enough to cause fires, so make sure you have a safe setup, which may include not letting it run unsupervised.

OctoPrint ingredients

• Raspberry Pi 3 (or newer)
MicroSD card
• Raspberry Pi power adapter
• USB cable (the connector type will depend on your printer)
• Webcam/Raspberry Pi Camera Module (optional)
• 3D-printed camera mount (optional)

Before we get started, it is not recommended that anything less than a Raspberry Pi 3 is used for this project. There have been reports of limited success using OctoPrint on a Raspberry Pi Zero W, but only if you have no intention of using a camera to monitor your prints. If you want to try this with a Pi Zero or an older Raspberry Pi, you may experience unexpected print failures.

Download OctoPi

Firstly, you will need to download the latest version of OctoPi from the OctoPrint website. OctoPi is a Raspbian distribution that comes with OctoPrint, video streaming software, and CuraEngine for slicing models on your Raspberry Pi. When this has finished downloading, unzip the file and put the resulting IMG file somewhere handy.

Next, we need to flash this image onto our microSD card. We recommend using Etcher to do this, due to its minimal UI and ease of use; plus it’s also available to use on both Windows and Mac. Get it here: balena.io/etcher. When Etcher is installed and running, you’ll see the UI displayed. Simply click the Select Image button and find the IMG file you unzipped earlier. Next, put your microSD card into your computer and select it in the middle column of the Etcher interface.

Finally, click on Flash!, and while the image is being burned onto the card, get your WiFi router details, as you’ll need them for the next step.

Now that you have your operating system, you’ll want to add your WiFi details so that the Raspberry Pi can automatically connect to your network after it’s booted. To do this, remove the microSD card from your computer (Etcher will have ‘ejected’ the card after it has finished burning the image onto it) and then plug it back in again. Navigate to the microSD card on your computer — it should now be called boot — and open the file called octopi-wpa-supplicant.txt. Editing this file using WordPad or TextEdit can cause formatting issues; we recommend using Notepad++ to update this file, but there are instructions within the file itself to mitigate formatting issues if you do choose to use another text editor. Find the section that begins ## WPA/WPA2 secured and remove the hash signs from the four lines below this one to uncomment them. Finally, replace the SSID value and the PSK value with the name and password for your WiFi network, respectively (keeping the quotation marks). See the example below for how this should look.

Further down in the file, there is a section for what country you are in. If you are using OctoPrint in the UK, leave this as is (by default, the UK is selected). However, if you wish to change this, simply comment the UK line again by adding a # before it, and uncomment whichever country you are setting up OctoPrint in. The example below shows how the file will look if you are setting this up for use in the US:

# Uncomment the country your Pi is in to activate Wifi in RaspberryPi 3 B+ and above
# For full list see: https://en.wikipedia.org/ wiki/ISO_3166-1_alpha-2
#country=GB # United Kingdom
#country=CA # Canada
#country=DE # Germany
#country=FR # France
country=US # United States

When the changes have been made, save the file and then eject/unmount and remove the microSD card from your computer and put it into your Raspberry Pi. Plug the power supply in, and go and make a cup of tea while it boots up for the first time (this may take around ten minutes). Make sure the Raspberry Pi is running as expected (i.e. check that the green status LED is flashing intermittently). If you’re using macOS, visit octopi.local in your browser of choice. If you’re using Windows, you can find OctoPrint by clicking on the Network tab in the sidebar. It should be called OctoPrint instance on octopi – double-clicking on this will open the OctoPrint dashboard in your browser.

If you see the screen shown above, then congratulations! You have set up OctoPrint.

Not seeing that OctoPrint splash screen? Fear not, you are not the first. While a full list of issues is beyond the scope of this article, common issues include: double-checking your WiFi details are entered correctly in the octopi-wpa-supplicant.txt file, ensuring your Raspberry Pi is working correctly (plug the Raspberry Pi into a monitor and watch what happens during boot), or your Raspberry Pi may be out of range of your WiFi router. There’s a detailed list of troubleshooting suggestions on the OctoPrint website.

Printing with OctoPrint

We now have the opportunity to set up OctoPrint for our printer using the handy wizard. Most of this is very straightforward — setting up a password, signing up to send anonymous usage stats, etc. — but there are a few sections which require a little more thought.

We recommend enabling the connectivity check and the plug-ins blacklist to help keep things nice and stable. If you plan on using OctoPrint as your slicer as well as a monitoring tool, then you can use this step to import a Cura profile. However, we recommend skipping this step as it’s much quicker (and you can use a slicer of your choice) to slice the model on your computer, and then send the finished G-code over.

Finally, we need to put in our printer details. Above, we’ve included some of the specs of the Creality Ender-3 as an example. If you can’t find the exact details of your printer, a quick web search should show what you need for this section.

The General tab can have anything in it, it’s just an identifier for your own use. Print bed & build volume should be easy to find out — if not, you can measure your print bed and find out the position of the origin by looking at your Cura printer profile. Leave Axes as default; for the Hotend and extruder section, defaults are almost certainly fine here (unless you’ve changed your nozzle; 0.4 is the default diameter for most consumer printers).

OctoPrint is better with a camera

Now that you’re set up with OctoPrint, you’re ready to start printing. Turn off your Raspberry Pi, then plug it into your 3D printer. After it has booted up, open OctoPrint again in your browser and take your newly WiFi-enabled printer for a spin by clicking the Connect button. After it has connected, you’ll be able to set the hot end and bed temperature, then watch as the real-time readings are updated.

In the Control tab, we can see the camera stream (if you’re using one) and the motor controls, as well as commands to home the axes. There’s a G-code file viewer to look through a cross-section of the currently loaded model, and a terminal to send custom G-code commands to your printer. The last tab is for making time-lapses; however, there is a plug-in available to help with this process.

Undoubtedly the easiest way to set up video monitoring of your prints is to use the official Raspberry Pi Camera Module. There are dozens of awesome mounts on Thingiverse for a Raspberry Pi Camera Module, to allow you to get the best angle of your models as they print. There are also some awesome OctoPrint-themed Raspberry Pi cases to house your new printer brains. While it isn’t officially supported by OctoPrint, you can use a USB webcam instead if you have one handy, or just want some very high-quality video streams. The OctoPrint wiki has a crowdsourced list of webcams known to work, as well as a link for the extra steps needed to get the webcam working correctly.

As mentioned earlier, our recommended way of printing a model using OctoPrint is to first use your slicer as you would if you were creating a file to save to a microSD card. Once you have the file, save it somewhere handy on your computer, and open the OctoPrint interface. In the bottom left of the screen, you will see the Upload File button — click this and upload the G-code you wish to print.

You’ll see the file/print details appear, including information on how long it’ll take for the object to print. Before you kick things off, check out the G-code Viewer tab on the right. You can not only scroll through the layers of the object, but, using the slider at the bottom, you can see the exact pattern the 3D printer will use to ‘draw’ each layer. Now click Print and watch your printer jump into action!

OctoPrint has scores of community-created plug-ins, but our favourite, Octolapse, makes beautiful hypnotic time-lapses. What makes them so special is that the plug-in alters the G-code of whatever object you are printing so that once each layer has finished, the extruder moves away from the print to let the camera take an unobstructed shot of the model. The result is an object that seems to grow out of the build plate as if by magic. You’ll not find a finer example of it than here.

Satisfying 3D Prints TimeLapse episode 7 (Prusa I3 Mk3 octopi)

3D Printing timelapses of models printed on the Prusa i3 MK3! Here’s another compilation of my recent timelapses. I got some shots that i think came out really great and i hope you enjoy them! as always if you want to see some of these timelapses before they come out or want to catch some behind the scenes action check out my instagram!

Thanks to Glenn and HackSpace magazine

This tutorial comes fresh from the pages of HackSpace magazine issue 26 and was written by Glenn Horan. Thanks, Glenn.

To get your copy of HackSpace magazine issue 26, visit your local newsagent, the Raspberry Pi Store, Cambridge, or the Raspberry Pi Press online store.

Fans of HackSpace magazine will also score themselves a rather delightful Adafruit Circuit Playground Express with a 12-month subscription. Sweet!

The post How to set up OctoPrint on your Raspberry Pi appeared first on Raspberry Pi.