Monthly Archives: August 2020

Atomic TV | The MagPi 97

via Raspberry Pi

Nothing on television worth watching? Ryan Cochran’s TV set is just as visually arresting when it’s turned off, as David Crookes reports in the latest issue of the MagPi magazine, out now.

Flat-screen televisions, with their increasingly thin bezels, are designed to put the picture front and centre. Go back a few decades, however, and a number of TVs were made to look futuristic – some even sported space age designs resembling astronaut helmets or flying saucers sat upon elaborate stands. They were quirky and hugely fun.

Maker Ryan Cochran’s project evokes such memories of the past. “I have a passion for vintage modern design and early NASA aesthetics, and I wanted to make something which would merge the two into an art piece that could fit on my shelf,” he recalls. “The first thing I could think of was a small television.” And so the idea for the Atomic TV came into being.

Made of wood and using spare tech parts left over from a couple of past projects, it’s a television that’s as compelling to look at when it’s turned off as when it’s playing videos on a loop. “My main concern was fit and finish,” he says. “I didn’t want this thing to look amateurish at all. I wanted it to look like a professionally built prototype from 1968.”

Turn on

Before he began planning the look of the project, Ryan wanted to make sure everything would connect. “The parts sort of drove the direction of the project, so the first thing I did was mock everything up without a cabinet to make sure everything worked together,” he says.

This posed some problems. “The display is 12 volts, and I would have preferred to simplify things by using one of the 5-volt displays on the market, but I had what I had, so I figured a way to make it work,” Ryan explains, discovering the existence of a dual 5 V-12 V power supply.

With a Raspberry Pi 4 computer, the LCD display, a driver board, and a pair of USB speakers borrowed from his son all firmly in hand, he worked on a way of controlling the volume and connected everything up.

“Power comes in and goes to an on/off switch,” he begins. “From there, it goes to the dual voltage power supply with the 12 V running the display and the 5 V running Raspberry Pi 4 and the small amp for the speakers. Raspberry Pi runs Adafruit’s Video Looper script and pulls videos from a USB thumb drive. It’s really simple, and there are no physical controls other than on/off switch and volume.”

Tune in

The bulk of the work came with the making of the project’s housing. “I wanted to nod the cap to Tom Sachs, an artist who does a lot of work I admire and my main concern was fit and finish,” Ryan reveals.

He filmed the process from start to end, showing the intricate work involved, including a base created from a cake-stand and a red-and-white panel for the controls. To ensure the components wouldn’t overheat, a fan was also included.

“The television runs 24/7 and it spends 99 percent of its time on mute,” says Ryan. “It’s literally just moving art that sits on my shelf playing my favourite films and video clips and, every now and then, I’ll look over, notice a scene I love, and turn up the volume to watch for a few minutes. It’s a great way to relax your brain and escape reality every now and then.”

Get The MagPi magazine issue 97 — out today

The MagPi magazine is out now, available in print from the Raspberry Pi Press onlinestore, your local newsagents, and the Raspberry Pi Store, Cambridge.

You can also download the PDF directly from the MagPi magazine website.

Subscribers to the MagPi for 12 months get a free Adafruit Circuit Playground, or can choose from one of our other subscription offers, including this amazing limited-time offer of three issues and a book for only £10!

The post Atomic TV | The MagPi 97 appeared first on Raspberry Pi.

Drifting Downhill with the SparkFun OpenLog Artemis

via SparkFun: Commerce Blog

There are an infinite number of questions to be asked about the world around us. Why is my mail so banged up when it's delivered? Where did the banging around occur, and how large was the force? What is the ambient light when lightning bugs decide to come out and flicker? How do wind and/or speed determine when a moving vehicle will tip on a banked corner? How much does doing 360s on a drift trike slow you down on your ride, and what is the optimal speed at which to enter a 360?

We decided to tackle that last question, and using the new SparkFun OpenLog Artemis (“OLA”), gather data quickly about how the change in acceleration affects Cassy’s drift triking. The OLA was the ideal module to use for this project because it was so simple to configure and ultimately read data from.

All we did was load in a blank FAT32 micro SD card, hook it up to a power source, ensure the IMU was enabled, and send it speeding down a hill with Cassy. The data is written to a CSV file on the SD card as well as formatted correctly with column headers, so you won’t have to do anything to read the data… not even write one line of code!

SparkFun OpenLog Artemis

SparkFun OpenLog Artemis

DEV-16832
$49.95

If you do want to dive into the analytics of the data, the fact that it is already organized in a CSV makes it easy to play around with in any code editor/language. We specifically used Jupyter Notebook and Python and its associative libraries to visualize how speed changes when doing 360s on a trike.

The SparkFun OpenLog Artemis is the ultimate plug and play partner; it enables you to be an everyday scientist and ask questions about the world around you, and allows you to have fast feedback through its datalogging and sensing capabilities.

What questions will you start answering with it in your pocket? Let us know, and be sure to check out the project video below, as well as Rob's product video that goes over all the specs. Happy drifting and hacking!

comments | comment feed

3D-printable cases for the Raspberry Pi High Quality Camera

via Raspberry Pi

Earlier this year, we released the Raspberry Pi High Quality Camera, a brand-new 12.3 megapixel camera that allows you to use C- and CS-mount lenses with Raspberry Pi boards.

We love it. You love it.

How do we know you love it? Because the internet is now full of really awesome 3D-printable cases and add-ons our community has created in order to use their High Quality Camera out and about…or for Octoprint…or home security…or SPACE PHOTOGRAPHY, WHAT?!

The moon, captured by a Raspberry Pi High Quality Camera. Credit: Greg Annandale

We thought it would be fun to show you some of 3D designs we’ve seen pop up on sites like Thingiverse and MyMiniFactory, so that anyone with access to a 3D printer can build their own camera too!

Adafruit did a thing, obvs

Shout out to our friends at Adafruit for this really neat, retro-looking camera case designed by the Ruiz Brothers. The brown filament used for the casing is so reminiscent of the leather bodies of SLRs from my beloved 1980s childhood that I can’t help but be drawn to it. And, with snap-fit parts throughout, you can modify this case model as you see fit. Not bad. Not bad at all.

Nikon to Raspberry Pi

While the Raspberry Pi High Quality Camera is suitable for C- and CS-mount lenses out of the box, this doesn’t mean you’re limited to only these sizes! There’s a plethora of C- and CS-mount adapters available on the market, and you can also 3D print your own adapter.

Thingiverse user UltiArjan has done exactly that and designed this adapter for using Nikon lenses with the High Quality Camera. Precision is key here to get a snug thread, so you may have to fiddle with your printer settings to get the right fit.

And, for the Canon users out there, here’s Zimbo1’s adapter for Canon EF lenses!

Raspberry Pi Zero minimal adapter

If you’re not interested in a full-body camera case and just need something to attach A to B, this minimal adapter for the Raspberry Pi Zero will be right up your street.

Designer ed7coyne put this model together in order to use Raspberry Pi Zero as a webcam, and according to Cura on my laptop, should only take about 2 hours to print at 0.1 with supports. In fact, since I’ve got Cura open already…

3D print a Raspberry Pi High Quality Camera?!

Not a working one, of course, but if you’re building something around the High Quality Camera and want to make sure everything fits without putting the device in jeopardy, you could always print a replica for prototyping!

Thingiverse user tmomas produced this scale replica of the Raspberry Pi High Quality Camera with the help of reference photos and technical drawings, and a quick search online will uncover similar designs for replicas of other Raspberry Pi products you might want to use while building a prototype

Bonus content alert

We made this video for HackSpace magazine earlier this year, and it’s a really hand resource if you’re new to the 3D printing game.

Also…

…I wasn’t lying when I said I was going to print ed7coyne’s minimal adapter.

The post 3D-printable cases for the Raspberry Pi High Quality Camera appeared first on Raspberry Pi.

MIDI-controlled slide whistle made with an Arduino Due

via Arduino Blog

Slide whistles and recorders can be great for learning music, and perhaps a bit of fun, but what about teaching a robot to play such a wind instrument? The Mixed Signal’s MIDI-controlled system could be used for just that.

The project is comprised of a 3D-printed fipple and piston that go into a PVC tube, while air input is via a centrifugal blower fan. A plunger with a rack-and-pinion gear are used to move the piston back and forth, changing the note being played.

A keyboard provides the user interface here, though any number of digital audio workstation devices should be able to duplicate this human task if needed. It’s hooked up to an Arduino Due with a CNC shield, which controls the single stepper motor.

You can find more details on the fipple flute on Hackster and Hackaday, and see a demo of it in action below.

Developing Web Applications on a Raspberry Pi with Flask

via SparkFun: Commerce Blog

So, you've got yourself a Raspberry Pi, and now you want to connect it to the internet to display all the data you’ve collected. Exciting stuff! But how in the heck do you actually do that?

There are a few popular methods to create web servers and web applications using your small single-board computer, and today we're going to cover one of the most commonly used - Flask!

First, let's cover what a web framework is. A web application framework is a collection of libraries and modules that enable web application developers to write applications without worrying about low-level details such as protocol and thread management.

Each framework has a different way in which it builds routes, models, views, database interactions, and the overall application configuration. All of this comes down to a compact set of API endpoints that each back end must implement, along with the allowed HTTP methods:

  • GET: retrieves data
  • POST: sends HTML from data to server
  • HEAD: same as GET method, but just returns the HTTP headers, and no response body
  • PUT: replaces the resource at the current URL with the resource contained within the request
  • DELETE: deletes the specified resource

Flask is one of the most popular Python web application frameworks, because it's easy to get started with and is incredibly readable.

It's built on Jinja2, a Python template engine that renders dynamic web pages. This is what ultimately allows you to pass Python variables into Flask's HTML templates. It's also built on Werkzeug, which implements a Web Server Gateway Interface (WSGI) server to run Python code to create a web application.

Starting your first application in Flask is just a few lines of code. Make sure to check that you have Python 3 downloaded on your Pi. We will specifically use pip to install Flask, like this: sudo pip3 install flask

Here's the web app:

from flask import Flask
app = Flask(__name__)

@app.route('/')
def index():
    return 'Hello SparkFun World!'

if __name__ == '__main__':
    app.run() `

However, just because Flask is a microframework doesn't mean the whole app exists inside an Python file. You'll ultimately have many other files, including HTML and CSS to design your webpage how you'd like. One of the best parts of Flask is that it allows you to create templates so your HTML stays consistent throughout your entire website.

First, make a directory within your app (mkdir app/templates) to create your template. Mine will be called index.html, and will display the air quality at different coordinates (thanks to my pHAT and Qwiic Environmental Sensors!).

<html>
    <head>
        <title>{{ title }}</title>
    </head>
    <body>
        <h1> GPS Coordinates: {{ coordinates }} </h1>
        <h1> Air Quality Index: {{ AQI }} </h1>
    </body>
</html>

The {{ and }} symbols show Python variables on a webpage. They are just placeholders for variables.

Now, to use our template we have to render it, and Flask has a module that can do that: from flask import render_template. We'll also change a bit of the code in our initial web app to allow for this new index file to be read.

app.route('/')
@app.route('/index')
def index():
    coordinates_Boulder = '40.0150° N, 105.2705° W'
    AQI_Boulder = '126'
    return render_template('index.html', title='Air Quality in Colorado', coordinates = coordinates_Boulder, AQI = AQI_Boulder)

Instead of having a static website, it'd be nice to continuously monitor the air quality, right?

import RPi.GPIO as GPIO
from flask import Flask, render_template
app = Flask(__name__)
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
sen = 16
senStats = GPIO.LOW

# Set button and PIR sensor pins as an input
GPIO.setup(sen, GPIO.IN)

@app.route("/")
def index():
    # Read Sensors Status
    senStats = GPIO.input(sen)
    templateData = {
        'title' : 'Air Quality Index',
        'Air Quality Sensor'  : senStats
    }
return render_template('index.html', **templateData)
if __name__ == "__main__":
app.run(host='0.0.0.0', port=80, debug=True)

Flask allows us to read in data through Python and display it on our webpage.

The opportunities are endless with this. You can connect with SQLAlchemy to enable a database abstraction layer, customize your webpage with CSS, or ultimately push it to the cloud over Google Cloud, Heroku or AWS. Let us know what kind of web dev you want to see more of, whether it's design and user experience, cloud technologies, or database integration!

comments | comment feed

Boston Dynamics’ Handle robot recreated with Raspberry Pi

via Raspberry Pi

You in the community seemed so impressed with this recent Boston Dynamics–inspired build that we decided to feature another. This time, maker Harry was inspired by Boston Dynamics’ research robot Handle, which stands 6.5 ft tall, travels at 9 mph and jumps 4​ ​feet vertically. Here’s how Harry made his miniature version, MABEL (Multi Axis Balancer Electronically Levelled).

MABEL has individually articulated legs to enhance off-road stability, prevent it from tipping, and even make it jump (if you use some really fast servos). Harry is certain that anyone with a 3D printer and a “few bits” can build one.

MABEL builds on the open-source YABR project for its PID controller, and it’s got added servos and a Raspberry Pi that helps interface them and control everything.

Installing MABEL’s Raspberry Pi brain and wiring the servos

Thanks to a program based on the open-source YABR firmware, an Arduino handles all of the PID calculations using data from an MPU-6050 accelerometer/gyro. Raspberry Pi, using Python code, manages Bluetooth and servo control, running an inverse kinematics algorithm to translate the robot legs perfectly in two axes.

Kit list

If you want to attempt this project yourself, the files for all the hard 3D-printed bits are on Thingiverse, and all the soft insides are on GitHub.

IKSolve is the class that handles the inverse kinematics functionality for MABEL (IKSolve.py) and allows for the legs to be translated using (x, y) coordinates. It’s really simple to use: all that you need to specify are the home values of each servo (these are the angles that, when passed over to your servos, make the legs point directly and straight downwards at 90 degrees).

When MABEL was just a twinkle in Harry’s eye

MABEL is designed to work by listening to commands on the Arduino (PID contoller) end that are sent to it by Raspberry Pi over serial using pySerial. Joystick data is sent to Raspberry Pi using the Input Python library. Harry first tried to get the joystick data from an old PlayStation 3 controller, but went with the PiHut’s Raspberry Pi Compatible Wireless Gamepad in the end for ease.

Keep up with Harry’s blog or give Raspibotics a follow on Twitter, as part 3 of his build write-up should be dropping imminently, featuring updates that will hopefully get MABEL jumping!

The post Boston Dynamics’ Handle robot recreated with Raspberry Pi appeared first on Raspberry Pi.