Posts with «arduino» label

A Slew of Open-Source Synthesizers

Hackaday reader [Jan Ostman] has been making microcontroller-based DIY synthesizers for quite a while now. Recently, he’s opened up the source for a lot of them so that you can play along at home. All of these virtual-analog synths and soundmakers can be realized on an Arduino or AVR ATmega328 if you happen to have one lying around.

Extra parts like a keyboard, some pushbuttons, or some potentiometer knobs to twiddle won’t hurt if you’d like to make something more permanent or more obviously playable, like [Jan] does. On the other hand, if you’d just like to get your feet wet, I’ve tweaked his code to be more immediately plug-and-play. The code is straightforward enough that it’s a good learning platform. So let’s take a quick tour through three drum machines and a string synth, each of which you can build on a breadboard in just a few minutes.

To install on an Arduino UNO, fetch the zip file from this GitHub repository, and move each subfolder to your Arduino sketch directory. You’re ready to play along.

Simple Drum Machines

[Jan] has two sample-playback~based drum machines that he’s published the code for: the dsp-D8 with straight-ahead drum samples and the dsp-L8 loaded with Latin percussion. They’re essentially the same code base, but with different samples, so we’ll treat them together.

Working through [Jan]’s code inspired me to write up a longer article on DDS playback, so if you want to brush up on the fundamentals, you can head over there. The short version is that you can change the pitch of playback of a sample by using a counter that’s much larger than the number of data points you’re going to play.

[Jan]’s drum machines all use the AVR’s hardware pulse-width modulation (PWM) peripherals to play the samples back out. You could use something fancier, but this gets the job done with just an optional resistor and capacitor filter on the output, bringing the total parts count to three: Arduino, 1 KOhm resistor, and a decent-sized (0.1 uF?) capacitor. An interrupt service routine (ISR) periodically loads a new sample value into the PWM register, and the AVR’s peripheral hardware takes care of the rest.

One nice touch is the use of a circular buffer that holds the playback sample values until the ISR is ready for them. In the case of the drum machines, there’s not much math for the CPU to do — it just combines the samples from all of the different simultaneous voices — but in his more complicated modules this buffer allows the CPU to occasionally take more time to calculate a sample value than it would otherwise have between updates. It buys [Jan]’s code some breathing room and still allows it to make the sample-playback schedule without glitching.

[Jan] adds individual pitch control for each sample, which is great for live playing or tweaking, and you can watch him use them in his two videos: one for the dsp-D8 and another for the dsp-L8. Wiring up so many knobs is a breadboard-salad, though, so I’ve gone through the code for you with a fine-toothed chainsaw, and hacked off [Jan]’s button-and-knob interface and replaced it with the Arduino’s built-in serial I/O.

To play my version of [Jan]’s drum machines, each sample is mapped to a key in the home row: “asdfjkl;”. If you’ve got a proper serial terminal program that transmits each keystroke in real-time, you’ll be tapping out rhythms at 9600 baud in no time. Note that the Arduino IDE’s built-in terminal only sends the keystroke after you hit “enter” — this makes playing in tempo very difficult. (I use screen /dev/ttyACM0 9600 or the terminal that’s built-in with Python’s pyserial library myself. What do Windows folks use for a real-time terminal?)

If you haven’t already, download this zip file, move each sub-folder to your Arduino sketch directory, and connect an amplified speaker either directly to your Arduino’s pin 11 and ground, or include an RC filter. It’ll only take a second before you’re playing. When you want the full version with all the knobs, head on over to [Jan]’s site.

O2 Minipops

[Jan]’s O2 Minipops machine mimics an old-school rhythm box: the Korg mini pops 7. Whether this primitive drum machine is horribly cheesy or divinely kitschy is in the ear of the beholder, but it’s a classic that has been used all over. [Jan]’s named his after an epic album Oxygene by Jean-Michel Jarre. You’ll hear them starting around 1:40 into the clip. Jarre famously used to press multiple buttons on the Minipops, making more complex drum patterns by playing more than one at a time.

The nice thing about having your own Minipops in firmware is that you can add the features you want to it. Instead of having to mash down multiple plastic buttons live on stage like poor Mr. Jarre, you can just tweak the firmware to suit. Need longer patterns? You’ve got the RAM. Emphasis? Swing? Tap tempo? It’s all just a matter of a few lines of code.

The sound playback code is just like the simpler drum machines above, so we won’t have to cover that again. The only real addition is the sequencer, but that’s where the real magic lies. After all, what’s a drum machine without some beats? Because there are eight possible drum sounds, each beat is a byte and so four bars of 4/4 time is just sixteen bytes stored in memory. I broke the data out into its own header file O2_data.h, so have a look there for the pre-programmed rhythms, and feel free to modify them to suit your own needs.

In order to make the O2 Minipops immediately playable, I stripped out the potentiometer code again (sorry [Jan]!) and passed off control over the serial port. The “user interface” has five controls. Press j and k to switch between patterns and f and d to speed up or slow down. (They’re under your first two fingers in the home row.) The space bar starts and stops the drum machine.

Try switching between the patterns on the fly with j and k — it’s a surprisingly fun way to create your own, slightly less cheesy, patterns. You need to download this code and give it a try. Trust me.

The Solina

[Jan] has also built up a full-fledged string synthesizer keyboard out of just an Arduino Nano. It’s patterned on the Eminent Solina String Ensemble, and we’ve got to say that it gets the sound spot on.

Solina — the Original

[Jan]’s Solina is a “virtual analog” in the sense that it builds up sawtooth waveforms in the microcontroller’s RAM and then outputs the corresponding voltage through PWM. And that’s a good start for a string synthesizer, because a filtered sawtooth waveform is a good first stab at the sound put out by a violin, for example.

Solina — the clone

The secret to the sound of the string section of an orchestra (and to string synthesizers that mimic it) is that it’s a combination of many different bowed instruments all playing at once. No matter how precise the players, they’re each slightly differently tuned, and none of the strings are resonating exactly in phase. The Solina mimics this by detuning each oscillator, naturally, and by moving them in and out of phase with each other. If you want to dig into the details of how exactly [Jan]’s Solina works, he explains it well in this blog post.

Again, I’ve converted it for direct-serial control, and you can control the envelope, detune, LFO speed, and modulation depth over the serial port. Press the spacebar once to simulate a keypress, and again to let go. Try the Solina with detune and pitch modulation around twenty, and play with the LFO rate and other parameters. That’s a lot of useful noise for just some sawtooth waves.

Keyboards and What’s Next

[Jan]’s builds are much more than what we’re demonstrating here, of course. His blog kicks off (in 2009!) with a project that essentially shoe-horns a PC into a keyboard enclosure, and the Solina and others get their own keys too. We’ve just presented the kernel of any such project — there’s a lot of labor-of-love left in wiring up all of the diodes necessary to do detection on a keyboard matrix, to say nothing of building enclosures, wiring up potentiometers, and making nice-looking front panels. But if you want to start down that path, you’ve at least got a good start.

[Jan]’s current project is the Minimo miniature monophonic synth that takes the Solina a step further and adds a lowpass filter with (digital) resonance to it. The resulting sounds are great, so we’re excited to see where [Jan] takes this one in the future.

Thanks again, [Jan], for opening the code up. And if any of you build something with this, be sure to post in the comments and let us all know. Since I started playing around with these, I’ve got the hankering to modularize the code up a bit and make it into something that’s even easier to adapt and modify. Maybe we’ll have to start up a Hackaday.io project — these little simple synths are just too much fun!


Filed under: Arduino Hacks, Hackaday Columns, musical hacks

Monitoring Solitary Bees Using Open Technology

“Bees in the Backyard” is a citizen science technology project to investigate the nesting behavior of Mason bees, created by Mike Teachman, amateur bee enthusiast and Paul Perrault senior field applications engineer.

Mason bees are somewhat unique because, unlike honeybees, they are solitary, every female is fertile, there are no worker bees, they carry pollen on their bellies, they nest in holes and are vital to pollination of many fruit trees.

The idea behind the project was to turn each bee’s entire nest into a capacitive sensor with the use of off-the-shelf open source hardware like Arduino Uno:

Following the innovative work of the UPEI in using non-invasive capacitance sensors to detect bees entering and exiting a hive, we decided to extend this study to determine if we could measure not just a bee moving past an opening in a hive, but actually measure bee activity, along with a sense of their deliveries. This involved the invention of a new type of non-invasive sensor, along with the development of a measurement system that would be used to gather large amounts of data.

 

The plan for the team for 2016 is to improve the project deploying an improved monitoring system at the same site and in particular:
• Develop a new capacitance sensor tube with increased accuracy
• Improve the visual appeal of nesting block and associated electronics
• Develop algorithms to mine the measurement dataset for bee activity patterns

Watch other videos on this youtube channel and read more about the project on Spectrum IEEE.

Arduino Blog 23 Feb 16:21
arduino  bees  featured  projects  science  uno  

Ski Buddy Jacket Uses Arduino to Teach Youngsters to Ski

Snow skiing looks easy, right? You just stay standing, and gravity does the work. The reality is that skiing is difficult for beginners to learn. [19mkarpawich] loves to ski, but he was frustrated seeing crying kids on skis along with screaming parents trying to coach them. Inspired by wearable electronics, he took an Arduino, an old jacket, some LEDs, and created Ski Buddy.

The brains in the jacket consist of an Adafruit Flora, accelerometer, and a battery pack. Conductive thread connects to LED sequins. The jacket can help teach linking turns, parallel skiing, hockey stops, and gradual pizza stopping. In addition to the build details and some notes on where not to place sensors (doubtlessly learned the hard way), [19mkarpawich] also does a detailed explanation of the software and how to use the jacket.

You can see a very short video demonstration of Ski Buddy below. We’ve seen more wearables lately, some of them pretty creative. Maybe it is time to learn how to sew if you can’t already.


Filed under: Arduino Hacks, wearable hacks
Hack a Day 23 Feb 03:00

Trojan 77: a gamified simulation of the Trojan virus

Trojan 77 is a gamified simulation of the Trojan virus running on Arduino Uno. The Trojan is a malware designed to provide unauthorised remote access to a user’s computer amongst other harmful possibilities and this prototype was designed to be exhibited at a technology museum to show the most important effects the virus. Inspired by the tilting labyrinth game, the prototype simulates a few key effects of the Trojan virus like passwords leaking out, files being deleted and culminating in a system crash.

Trojan 77  was created by a team of Physical Computing students (Dhrux Saxena, Gunes Kantaroglu, Liliana Lambriev, Karan Chaitanya Mudgal) at CIID:

The idea of designing something analog to explain a digital construct was an exciting challenge to undertake. The way that computer viruses operate can be very complicated and hard to explain without overloading people with detailed information. Making this information visual via animated projections helped to communicate the effects in a fun and memorable way.

The Trojan moved through several prototyping stages. Initially, the wooden structure was built, followed by the maze. The structure as a whole became functional with the addition of Arduino and Processing. Two servo motors controlled by a joystick enabled the tilt while the movement of the ball triggered distinct light sensors which in turn triggered events in a Processing sketch mapped onto the maze.

The students created also a great video documentary  to explain the project with a style inspired by the work  of Charles and Ray Eames:

Control 12 servos with the Jetson TK1 & Jetduino

Let's Make Robots 21 Feb 13:48

Home-Made Solenoid Motor

Want to really understand how something works? Make one yourself. That’s the approach that Reddit user [Oskarbjo] took with this neat electric motor build. He made the whole thing from scratch, using an Arduino, 3D printing, and ample quantities of wire to create a solenoid motor. This transforms the linear force of a solenoid, where a magnet is moved by a magnetic field, into rotary force. It’s rather like an internal combustion engine, but driven by electricity instead of explosions. Hopefully.

[Oskarbjo]’s engine seems to work, including a rather neat mechanism to detect the rotation of the shaft and relay that back to the controller. He hasn’t posted much detail in the build process, unfortunately, but did say that “If you’d want to build something similar I can probably help you out a bit, but half the fun is coming up with your own solutions.” Amen to that. We’ve seen a few neat solenoid motor builds, but this one wins points for starting from scratch. There is an Instagram video of the motor running after the break.



Filed under: Arduino Hacks

Macchina poetica converts sounds into onomatopoeic words


Macchina Poetica is a digital prototype converting sounds into onomatopoeic words and images and it’s inspired by the art of the Futurism movement.

Futurism is a modernist, avant-garde artistic movement originated in Italy in the early 20th century. Thanks to sound representation, Futurism artists aimed to emphasize speed, technology, youth and violence, all concepts arising from industrial innovations and war.

In order to keep continuity with this particular artistic movement, the authors, Alessandra Angelucci, Aris Dotti, Rebecca Guzzo, students at Master of Advanced Studies in Interaction Design SUPSI, decided to design an object that looks like the musical instrument of Futurism movement (precisely a Celesta). The object plays a metallic sounds and the user is facilitated in understanding how to use the object due to a instrument-like interface.

The machine is built using 4 piezo sensors, a thermal printer, a board, electrical cables, 4 resistors (1K), a 6 volt power supply and a Genuino Uno board.

The instrument’s interface is designed with plywood, metal plates and sponge that serves as a shock absorber. Between the metal plates and the sponge there are the piezo sensors along with resistors communicating with the Genuino Uno board every time the user interacts with the metallic plates. Once the Genuino receives the signal, it sends a command to the thermal printer that will print a word or a Futurism poem.

The interaction takes place when the user with the help of a metal tool (for example a screwdriver or a wrench) strikes the metal plates with different pressures. At the end of the performance the user and the viewers can have a clear overview of the produced sounds reviewing the printed paper outputs.

The prototype is the result of two weeks physical computing class Creating Tangible Interfaces held by Ubi De Feo at Maind program SUPSI  in Lugano, the goal of the course is how to make tangible interfaces via learning fundamentals of electronics prototyping and interaction design.  (Applications are open for the next edition 2016/2017 starting in September 2016)

Hear the sound of 300 stars

Stellar is an interactive installation by sound artist Francesco Fabris, which aims to create a sonic representation of stars and constellations through a dedicated interface.

The project has been developed using two Arduino Uno, LeapMotion and Max7 software managing data of more than 300 stars and 44 constellations, stored from the open-source software Stellarium, and coded to interact with the robotic arms.

One Arduino Uno board controls four servo motors and a second one controls the led stripes. The motors are controlled with two LeapMotion but since LeapMotion doesn’t support two devices on one computer, he used two miniMac  connected through an Ethernet network.

Since there’s no sound in space, Francesco wanted  to conceptualize a link between electromagnetic and sound waves  to create a minimalistic, interactive device which would allow visitors to learn about specific stars through sound information:

The base of the system is a cylindrical structure, on top of which are displayed the most important constellations of the northern sky. Above this representation are two robotic arms. When the tip of one of the arms aligns with a star, information on the selected star is transformed into simple sine waves, changing the colour the star emanates.

Two players can use the system at the same time, by moving their right hands over the two black, circular sensors. This allows them to move the robotic arm both horizontally and vertically.
The data analyzed for each star are: temperature (color index: red star = old and cold, blue star = hot and young), brightness (as seen from Earth), distance (from Earth) respectively transformed into: frequency (Hz), amplitude (dB), duration (ms).
The colder the star, the lower the pitch; the brighter it appears to us from Earth, the louder the sound; the further from Earth, the longer the duration.
For example, a bright, red star four thousands light years from the Earth would generate a low frequency, loud and long sound. A blue star which is closer to the Earth would generate a high frequency, weaker and shorter sound.

The background drone-sound is white noise (which is a combination of all frequencies, the opposite of space-silence). When a constellation is triggered, the number representing its area (squared degrees), becomes the cutoff frequency of a low-pass filter for the noise signal. In this way, larger constellations will gradually increase their frequency.

Don’t miss the “Making of” video:

Stellar has been produced with the support of the DE.MO./MOVIN’UP I Session 2015 project, and promoted by the Ministry of Cultural Heritage & Activities & Tourism, General Directorate for Contemporary Art, Architecture and Urban Suburbs and GAI – Association for the Circuit of the Young Italian Artists.

Nerf Turret controlled by Slack

What happens when you give a former Navy weapons engineer some development boards and ask him to build “something cool”? What happens when you give a kid finger paints? [Seb] obviously built an IoT Nerf Turret Gun controlled via a team communication app.

The weapon was a Nerf Stampede which was hacked so it could be fired electronically. The safety switch was bypassed and a relay provided the firing signal. The electronics stack consists of an Intel Galileo, a motor shield and a relay shield. The turret assembly was built using off the shelf structural parts from Actobotics. Stepper motors provide motion to the turret. The fun begins with how the software is implemented. An iBeacon network detects where people sit at in the office. So when you type in the name of your target in a messaging app, it knows where they’re sitting, aims at them, and pops a nerf dart at them.

The lessons learned are what makes such projects worth their while. For example, USB is a standard. And the standard says that USB cables be not more than 1.8 m long. [Seb] was reminded of this when his electronics worked on his workbench, but refused to work when placed in-situ and connected via a 3m long cable – the serial link just wouldn’t work.

Mounting the gun such that it was nicely balanced was another challenge. Eventually, he had to use a couple of AA cells taped to the front of the gun to get it right. This could be useful though, since he plans to replace the dead weights with a sighting camera. One last hack was to zip tie heat sinks to the motor drivers, and he had a good reason to do that. Read more about it in his blog. And check out the video as someone takes aim and shoots a target via SLACK, the team messaging application.


Filed under: hardware

How to turn data into cocktails!

Data Cocktail is a device which translates in a tasty way the Twitter activity and running on Arduino Due and Arduino Pro Mini. When you want a cocktail, the machine will look for the five latest messages around the world quoting one of the available ingredients. These messages define the drink composition and Data Cocktail not only provides a unique kind of drink, but it also prints the cocktail’s recipe along with the corresponding tweets.
Once the cocktail mix is done, Data Cocktail thanks the tweeters who have helped at making the recipe, without knowing it. Check the video below to see how it works:

Data Cocktail was created in a workshop held at Stereolux in Nantes by a theme composed by Bertille Masse, Manon Le Moal-Joubel, Sébastien Maury, Clément Gault & Thibaut Métivier.

They made it using Processing and Arduino:

A first application, developed in Processing, pilots the device. The requests are performed using the Twitter4J library, then the application processes the data and controls the device, i.e. the robot, the solenoid valves and the light. The robot itself is based on a modified Zumo frame, an Arduino Pro, a Motor Shield and a Bluetooth module. The solenoid valves and the LEDs are controlled by an Arduino Due connected via USB. The impression is realized by Automator.

To prepare a cocktail, the machine can take up to a minute and may provide up to 6 different ingredients!