Tag Archives: Python

Machine learning for the maker community

via Arduino Blog

mellis-aday

At Arduino Day, I talked about a project I and my collaborators have been working on to bring machine learning to the maker community. Machine learning is a technique for teaching software to recognize patterns using data, e.g. for recognizing spam emails or recommending related products. Our ESP (Example-based Sensor Predictions) software recognizes patterns in real-time sensor data, like gestures made with an accelerometer or sounds recorded by a microphone. The machine learning algorithms that power this pattern recognition are specified in Arduino-like code, while the recording and tuning of example sensor data is done in an interactive graphical interface. We’re working on building up a library of code examples for different applications so that Arduino users can easily apply machine learning to a broad range of problems.

The project is a part of my research at the University of California, Berkeley and is being done in collaboration with Ben Zhang, Audrey Leung, and my advisor Björn Hartmann. We’re building on the Gesture Recognition Toolkit (GRT) and openFrameworks. The software is still rough (and Mac only for now) but we’d welcome your feedback. Installations instructions are on our GitHub project page. Please report issues on GitHub.

Our project is part of a broader wave of projects aimed at helping electronics hobbyists make more sophisticated use of sensors in their interactive projects. Also building on the GRT is ml-lib, a machine learning toolkit for Max and Pure Data. Another project in a similar vein is the Wekinator, which is featured in a free online course on machine learning for musicians and artists. Rebecca Fiebrink, the creator of Wekinator, recently participated in a panel on machine learning in the arts and taught a workshop (with Phoenix Perry) at Resonate ’16. For non-real time applications, many people use scikit-learn, a set of Python tools. There’s also a wide range of related research from the academic community, which we survey on our project wiki.

For a high-level overview, check out this visual introduction to machine learning. For a thorough introduction, there are courses on machine learning from coursera and from udacity, among others. If you’re interested in a more arts- and design-focused approach, check out alt-AI, happening in NYC next month.

If you’d like to start experimenting with machine learning and sensors, an excellent place to get started is the built-in accelerometer and gyroscope on the Arduino or Genuino 101. With our ESP system, you can use these sensors to detect gestures and incorporate them into your interactive projects!

Circuit Bender Artist bends Fresnel Lens for Art

via hardware – Hackaday

Give some mundane, old gear to an artist with a liking for technology, and he can turn it into a mesmerizing piece of art. [dmitry] created “red, an optic-sound electronic object” which uses simple light sources and optical elements to create an audio-visual performance installation. The project was the result of his collaboration with the Prometheus Special Design Bureau in Kazan, Russia. The inspiration for this project was Crystall, a reconstruction of an earlier project dating back to 1966. The idea behind “red” was to recreate the ideas and concepts from the 60’s ~ 80’s using modern solutions and materials.

The main part of the art installation consists of a ruby red crystal glass and a large piece of flexible Fresnel lens, positioned in front of a bright LED light source. The light source, the crystal and the Fresnel lens all move linearly, constantly changing the optical properties of the system. A pair of servos flexes and distorts the Fresnel lens while another one flips the crystal glass. A lot of recycled materials were used for the actuators – CD-ROM drive, an old scanner mechanism and old electric motors. Its got a Raspberry-Pi running Pure Data and Python scripts, with an Arduino connected to the sensors and actuators. The sensors define the position of various mechanical elements in relation to the range of their movement. There’s a couple of big speakers, which means there’s a beefy amplifier thrown in too. The sounds are correlated to the movement of the various elements, the intensity of the light and probably the color. There’s two mechanical paddle levers hanging in there, if you folks want to hazard some guesses on what they do.

Check out some of [dmitry]’s earlier works which we featured. Here’s him Spinning a Pyrite Record for Art, and making Art from Brainwaves, Antifreeze, and Ferrofluid.


Filed under: hardware, musical hacks

Ten days to enter our Astro Pi competition

via Raspberry Pi

Calling all space coders! A quick announcement:

T minus ten days to the deadline of our latest Astro Pi competition.

You have until 12 noon on Thursday 31st March to submit your Sonic Pi tunes and MP3 player code.

Send your code to space

British ESA astronaut Tim Peake wants students to compose music in Sonic Pi for him to listen to. Tim needs to be able to listen to your tunes on one of the Astro Pi flight units, so we are also looking for a Python program to turn the units into an MP3 media player.  You do need to be 18 or under and live in the UK.

We have some fantastic competition judges: musicians including synthpop giants OMD and film composer Ilan Eshkeri, as well as experts from the aerospace industry and our own crack team of developers.

If you haven’t used Sonic Pi before, here is a brilliant introduction from our Education Team:

Getting Started With Sonic Pi | Raspberry Pi Learning Resources

Sonic Pi is an open-source programming environment, designed for creating new sounds with code in a live coding environment; it was developed by Dr Sam Aaron at the University of Cambridge. He uses the software to perform live with his band.

You can find all the competition information, including how to enter, at astro-pi.org/coding-challenges.

The post Ten days to enter our Astro Pi competition appeared first on Raspberry Pi.

Sense HAT egg drop game

via Raspberry Pi

Here’s a little game for your Raspberry Pi and Sense HAT from Dan Aldred. Dan’s a UK teacher (one of those people you wish had been YOUR teacher when you were a kid). So, as always with a Dan resource, he’s made the code available on GitHub to make made sure that kids (and adults) can build the game themselves, and learn plenty of useful stuff while they’re at it.

Raspberry Pi SenseHat Egg Drop Game #

Egg Drop is a simple game where eggs fall from the top of the SenseHat. The egg falls toward the ground under the influence of gravity! You have a basket which you can use to catch the eggs. If you catch one, then you gain one point and your score goes up.

The Sense HAT‘s perfect for building this kind of activity; Sense HAT games using the motion sensors, the humidity sensor (we’ve had some fun coming up with Boppit clones you have to blow on) and the accelerometers. See if you can come up with something that uses the magnetometer and the temperature sensor. If you’re already using one, you’re in good company: there are two on the ISS as part of the Astro Pi programme. (Brace yourselves, ‘cos there’s no gravity.)

Thanks Dan!

The post Sense HAT egg drop game appeared first on Raspberry Pi.

Raspberry PiLab at PyCon Namibia 2016

via Raspberry Pi

Ben: Here’s a guest post from Daniele Procida, Community Manager at Divio Djangonaut and lover of Python Conferences.


I’m lucky enough not only to work for a company that uses and produces open-source software, but likes to help support it by giving me the opportunity to be involved in Python/Django community conferences around the world.

The most recent of these was PyCon Namibia 2016, in January, organised by a committee of volunteers from Namibia and the UK.

Daniele Procida on Namibian television during the conference

Daniele Procida on Namibian television during the conference

A PyCon is a Python conference; there are dozens of them held around the work each year, from huge ones, such as PyCon US which runs for 9 days and hosts thousands of visitors, to much smaller weekend events. And of course there are PyCons of every size in between – wherever you are, there’s probably a PyCon not too far away.

PyCon Namibia 2016 ran from the 24th to 29th January, at the University of Namibia in Windhoek. We had nearly 120 attendees, from most corners of the world – Brazil, USA, Canada, UK, Netherlands, Germany, South Africa, Nigeria, Zambia and Zimbabwe.

As well as talks on a wide variety of Python-related subjects, PyCon also held a number of workshops and tutorials – Python for beginners, Django Girls, django CMS, automated testing, Python packaging using Conda and more.

PyCon talks The queue for lightning talks

It can often be a challenge running such workshops at conferences, because attendees don’t always have suitable software already installed. They typically need things like a good text editor, version control and a terminal application, not to mention a correctly-configured Python environment.

Django Girls workshop Jessica Upani, Chair of PyNam

In Namibia, where many people don’t have access to a computer of their own, it can be more challenging still. Even where there are computer labs, they’re not always suitable for this kind of work. Unlike keyboards, mice or displays, which are relatively easy to get hold of, computers with the requisite Python software development toolchain installed are not.

PiLab

Our solution was to prepare a travelling computer laboratory, a Raspberry PiLab.

With a generous grant from the Python Software Foundation and financial support from the Phoenix Project at Cardiff University (one of the main backers of the conference) we purchased and configured 50 Raspberry Pis – complete with HDMI-VGA converters and wireless adaptors – from The PiHut (who also supported the project by offering a substantial discount).

It wasn’t much work – we had to set up just one machine, and then patiently copy the disk image to 49 other SD cards.

50 Raspberry Pis take up remarkably little space in a suitcase. We had more than one conversation with an airport official that went like this:

“What’s in this suitcase?”
“Fifty computers for a conference.”
“Ha ha.”
“No, really, there are fifty computers in there.”

In practice, our Raspberry Pis proved to be extremely effective and did their job beautifully, just as we’d hoped, but we also noticed some unexpected things too.

50 Raspberry Pis The PiLab in action

If you have to borrow or share a computer, you can’t simply mess around or experiment with it, for fear of breaking something. That’s a luxury that comes from having a computer of your own, and it’s necessary when you’re learning programming: you have to be able to install, tweak, configure and even break things.

The very low cost of the Raspberry Pis, and even their small size and modest appearance, made users feel less inhibited about trying things out and experimenting.

In countries like Namibia, the Raspberry Pi represents an excellent opportunity for overcoming barriers to participation in programming. At the end of the conference batches of the Raspberry Pis were handed over to new custodians, to be used for future teaching workshops, learning, experimentation and exploration.

Recipients included the department of Computer Science at UNAM, PyNam (the Python Namibia Society), PyZim (Python Zimbabwe) and numerous individual attendees in the Namibian Python community, amongst them several Namibian high-school pupils who attended the conference.

The Raspberry Pis were genuinely one of the stars at PyCon Namibia, and we were delighted at how well the Pi once again proved itself to be an ideal way to put the opportunity to be a programmer into the hands of more people.

We’re eager to find out how they are used over the coming months.

About Namibia

Namibia, in south-western Africa, has the world’s second-lowest population density. It’s known to many people mainly as a tourist destination, for its abundant wildlife and extraordinary landscapes, or as a site of rich natural resources, but there’s much more to it than that.

Since its independence in 1990, Namibia has been a democratic and politically stable nation, with a free press and an independent judiciary. It’s a safe and orderly place. Though it suffers from economic hardship and inequality, it has a promising future, and we’re sure that having a home-grown software development industry will be part of that future – and the Raspberry Pi.

What’s next

We expect some great things from the growing Python community in Namibia. We heard some extremely impressive talks at the conference, and there is clearly not only some real programming talent there, but also an enthusiasm for it that will go a long way. Combined with the African attitude of can-do, we’re sure it will mean that we’ll be seeing and hearing more from Namibian programmers in the future.

And if you want to learn more about it at close hand, watch this space – and come to PyCon Namibia 2017 yourself.

In the meantime, the enthusiasm we saw at the event has not waned. Attendees from other African countries have gone back home with plans for new events of their own. The newly-created Python Africa email list is already discussing the organisation of PyCons in Nigeria  and Benin, and plans are afoot for more Django Girls workshops across the continent.

No doubt there’ll be a role for Raspberry PiLabs there too.

The post Raspberry PiLab at PyCon Namibia 2016 appeared first on Raspberry Pi.

Make Games with Python – the latest e-book in The MagPi Essentials range!

via Raspberry Pi

Make Games with Python is designed to help you learn the coding skills you need to create amazing games and applications on your Raspberry Pi. The best bit? The price starts at free

While countless millions of us like nothing more than spending hours racking up high scores on our favourite games, too few of us are exposed to an even more gratifying way to spend the evening – making them.

RPi_Essentials_eBook2_PythonGames-001

Written by technologist and tinkerer, Sean M. Tracey, Make Games with Python is made up of ten chapters that take you on a whirlwind tour of Pygame’s game-making capabilities. The book helps you learn essentials Python skills like lists, dictionaries, classes and more.

Here’s a quick breakdown of what you can expect to learn:

  • Creating shapes and paths
  • Movement and animation
  • Using the keyboard & mouse
  • Adding sound and music
  • Simulating physics and forces
  • Building classes for actors
  • Creating your own shoot-em ‘up
Games_on_Tablet

Download the free PDF today (11MB)

Like the look of The Essentials range? You might quite fancy Conquer the Command Line. The terminal window isn’t as scary as you might think!

If you’d like to support the Raspberry Pi Foundation’s charitable aims you can buy both Make Games with Python and Conquer the Command Line on your favourite Apple or Android device for £2.99 / $3.99 each.

The MagPi app itself is entirely free to download and comes complete with the first 30 issues free!

app_store google_play

The post Make Games with Python – the latest e-book in The MagPi Essentials range! appeared first on Raspberry Pi.