Vous consultez actuellement le France version du site.
Voulez-vous passer à votre site local ?
13 TEMPS DE LECTURE MIN

ROBOTS

Building a web-based robot control interface

In part five of his series, Les Pounder shows us how to build a custom web interface for controlling your DIY robot.

Credit: https://anvil.works

Part Five!

Don’t miss next issue, subscribe on page 16!

OUR EXPERT

Les Pounder is associate editor at Tom’s Hardware and a freelance maker. He blogs about hacks and makes at http://bigl.es.

YOU NEED

All of the code for this project, circuit diagrams and images can be downloaded from our GitHub repository: https:// github.com/ lesp/Linux- Format- Robot/ archive/ refs/heads/main.zip

By the end of part four, we had successfully built our robot from a kit, tested the motors and looked at a number of sensors, then we learnt how to use a Bluetooth controller. All of the previous parts are building up to our robot becoming complete in the final sixth part.

For this section of the build, we are going to learn how to use a free web service called Anvil (https://anvil.works). The Anvil service is where we can develop web apps in pure Python. Using an uplink, we will connect our robot to a custom-created web interface and then use that interface to control our robot.

This might sound a little scary right now, and while Anvil does have a learning curve, fear not! Anvil is extremely easy to use once you understand how it works. With that in mind, let’s get started.

Hammer the Anvil

As Anvil is based in the cloud, we can access and create projects from any web-enabled device. As we’re using a Raspberry Pi 4 for the robot, open a Chromium browser and visit https://anvil.works/. Click on Pricing or Start Building to sign up for a free account.

Anvil works by creating ‘apps’. These are all webbased, and Anvil acts as an interface between us and our code. Anvil can be programmed to run code when a button is pressed, show an image captured on a remote device, store data in a database and many other services. Our need is simple: we want to press buttons and run code on our robot. To do this, Anvil has a clever uplink tool that securely links our robot to Anvil, where we can use buttons to send commands to the robot. To do this, we need to create a new blank app. Select Material Design 3 as the template and Anvil displays an interface that looks like Photoshop and an IDE blended together. By default, Anvil drops us into the Design tab, which is where we create a form that acts as the user interface for our app. We can change the view to Code, where we write the Python code, and Split, which splits the screen between design and code.

Débloquez cet article et bien plus encore avec
Vous pouvez en profiter :
Découvrez l'intégralité de cette édition
Accès instantané à plus de 600 titres
Des milliers d'anciens numéros
Pas de contrat ni d'engagement
Essayer pour €1.09
S'ABONNER
30 jours d'accès, puis seulement €11,99 / mois. Résiliation à tout moment. Nouveaux abonnés uniquement.


En savoir plus
Pocketmags Plus
Pocketmags Plus

Cet article est tiré de...


View Issues
Linux Format
May 2023
VOIR EN MAGASIN

Autres articles dans ce numéro


WELCOME
In with the old!
We’re in no position to talk about getting
REGULARS AT A GLANCE
Ubuntu 23.04: Lunar Lobster latest
Exciting things are happening: a new installer, hardened app security and a revamped desktop environment.
Linux on Apple Mx hardware
The Linux kernel now officially supports M-series Macs. But before you get too excited, full integration is a long way off.
It’s a flat future
Flathub to go independent and accept app payments.
END OF LIFE
Donnie Berkholz is senior vice president product at
RELIABLY SECURE
Keith Edmunds is MD of Tiger Computing, which
Fractional scaling is still coming…
Gnome to support protocol.
Half-Life 1 gets ray tracing
Old game given makeover.
Plasma 6 is in development
Version 6 uses Qt6.
Distro watch
What’s behind the free software sofa?
HANDS UP!
Moshi Turner is a software engineer at Collabora.
Kernel watch
Jon Masters keeps up with all the latest happenings in the Linux kernel, so you don’t have to.
THE ITANIC
Jon Masters is a kernel hacker who’s been
Answers
Got a burning question about open source or the kernel? Whatever your level, email it to answers@linuxformat.com
MAILSERVER
WRITE TO US Do you have a burning
BACK ISSUES MISSED ONE?
ISSUE 300 April 2023 Product code: LXFDB0300 In
Time Switch
Version : 2023.01.28 Web : https:// github.com/fsobolev/timeswitch
ChatGPT
Version: 0.11.0 Web : https://app.nofwl.com O penAI’s
Tokodon
Version: 23.01.0 Web: https://apps.kde.org/tokodon Another online service
CopyQ
Version : 6.4.0 Web : https://hluk.github.io/CopyQ The
HSTR
Version : 2.6.0 Web : https://github.com/dvorka/hstr Like
Katalog
Version : 1.16 Web: https://sourceforge . net/projects/katalogg
Stellarium
Version: 1.2 Web: https://stellarium.org S tellarium
iQPuzzle
Version: 1.2.9 Web: https://elth0r0 . github.io/iqpuzzle
Veloren
Version: 0.14.0 Web: https://veloren.net V eloren
Eiciel
Version: 0.10.0 Web: https://rofi . roger-ferrer.org/eiciel
Forgetpass
Version: 1.0.12 Web: https://github . com/alexkdeveloper/forgetpass Virtually
REVIEWS
Sabrent Rocket 2230 SSD
Shane Downing test-drives the perfect Steam Deck drive upgrade.
Intel Core i5 13400F
Being skinflint northern types around here, it’s high praise for Jacob Ridley to say this is the best budget processor right now!
Brave Browser 1.48.171
Nate Drake climbs on his soap box and explains why Brave is the last word in private browsing.
Endless OS 5.0.1
Nate Drake has hours of endless fun with the colourful and simple-to-use Endless OS without once needing to go online.
Vanilla OS 22.10 R7
With his first taste of the ultra-secure Vanilla OS, Nate Drake finds that plain doesn’t by any means equal boring.
Tor Browser 12.0.3
Nate Drake nosedives into the dark net with the Tor Browser and is blown away by its new censorship-resistant features.
Rogue Legacy 2
Workers with endless descendants happy to repeat their work over and over? Anne-Marie Coyle has never seen The Management so happy…
ROUNDUP
Lightweight desktops
In search of extra speed and efficient use of resources checks out the best lightweight desktop environments
SAVE YOUR OLD PC!
Give your old hardware some extra longevity and beat the fiscal blues. shows you how Windows fails and Linux Mint prevails
Pi USER
New Raspberry Pi camera launched
The £50 camera eliminates rolling shutter artefacts, the bane of digital photography!
RetroFlag GPi CASE 2W
Going back to the future is Les Pounder’s go-to retro phrase – let’s hope this case isn’t as long in the tooth.
Biqu Hurakan
Forever cleaning surfaces with isopropyl alcohol, Denise Bertacchi wonders whether this is the printer for her?
Using the GPIO with MicroBlocks
Les Pounder scratches an itch and builds code for his Raspberry Pi Pico using drag-and-drop coding blocks.
TOP OF THE FOSS!
TRACK YOUR FITNESS
Michael Reed looks at an open source Android app that can track your fitness.
TUTORIALS
Fast and easy image processing
Shashank Sharma dreams of achieving a leaner version of himself. Until then, he’ll settle for an ImageMagick derivative that’s skinnier, yet useful.
Host your own music streaming server
Nick Peers discovers how to make your personal music collection available from anywhere with this simple, but effective, music server.
Relive classic FOCAL days on your PDP-11
It’s probably not one of your favourite languages, but Mike Bedford says if you want to learn about programming’s heritage, don’t ignore FOCAL.
Enhance GIMP with must-have plugins
For many years, plugins have extended the basic functions of GIMP. Karsten Günther pick the ones he thinks you shouldn’t be without.
Build your own distro with NixOS
“Why, I do declare!” Matt Holder proclaims as he builds his very own operating system, using just an ISO file and declarative text files…
ChatGPT troubleshoots your Linux problems
Nick Peers investigates the different ways in which ChatGPT might help you maintain and fix problems with your PC.
IN DEPTH
MIND YOUR LANGUAGE!
Interested in learning a new language? Or just curious about current hot technologies? Darien Graham-Smith explores the language leaderboard.
CODING ACADEMY
Become a C++ chess master
Tiring of retro gaming rewrites, Andrew Smith turns his grandmaster mind to more classical games in a 3D style.
Observability of the kernel and containers
Barely able to contain himself, Mihalis Tsoukalos explains how to use eBPF to monitor applications, the Linux kernel and containers
Chat
X
Support Pocketmags