Less Rock, More Roll: A MIDI Barrel Piano

Strolling around a park, pedestrian zone, or tourist area in any bigger city is rarely complete without encountering the sound of a barrel organ — the perfect instrument if arm stamina and steady rotation speed are your kind of musical skills. Its less-encountered cousin, and predecessor of self-playing pianos, is the barrel piano, which follows the same playing principle: a hand-operated crank rotates a barrel, and either pins located on that barrel, or punched paper rolls encode the strings it should pluck in order to play its programmed song. [gabbapeople] thought optocouplers would be the perfect alternative here, and built a MIDI barrel piano with them.

Keeping the classic, hand-operated wheel-cranking, a 3D-printed gear mechanism rolls a paper sheet over a plexiglas fixture, but instead of having holes punched into it, [gabbapeople]’s piano has simple markings printed on them. Those markings are read by a set of Octoliner modules mounted next to each other, connected to an Arduino. The Octoliner itself has eight pairs of IR LEDs and phototransistors arranged in a row, and is normally used to build line-following robots, so reading note markings is certainly a clever alternative use for it.

Each LED/transistor pair represents a dedicated note, and to prevent false positives from neighboring lines, [gabbapeople] 3D printed little collars to isolate each of the pairs. Once the signals are read by the Arduino, they’re turned into MIDI messages to send via USB to a computer running any type of software synthesizer. And if your hands do get tired, you can also crank it with a power drill, as shown in the video after the break, along with a few playback demonstrations.

It’s always fun to see a modern twist added to old-school instruments, especially the ones that aren’t your typical MIDI controllers, like a harp, a full-scale church organ, or of course the magnificently named hurdy-gurdy. And for more of [gabbapeople]’s work, check out his split-flip weather display.

Continue reading “Less Rock, More Roll: A MIDI Barrel Piano”

Ask Hackaday: Are 80 Characters Per Line Still Reasonable In 2020?

Software developers won’t ever run out of subjects to argue and fight about. Some of them can be fundamental to a project — like choice of language or the programming paradigm to begin with. Others seem more of a personal preference at first, but can end up equally fundamental on a bigger scale — like which character to choose for indentation, where to place the curly braces, or how to handle line breaks. Latest when there’s more than one developer collaborating, it’s time to find a common agreement in form of a coding style guide, which might of course require a bit of compromise.

Regardless of taste, the worst decision is having no decision, and even if you don’t agree with a specific detail, it’s usually best to make peace with it for the benefit of uniformly formatted code. In a professional environment, a style guide was ideally worked out collaboratively inside or between teams, and input and opinions of everyone involved were taken into consideration — and if your company doesn’t have one to begin with, the best step to take is probably one towards the exit.

The situation can get a bit more complex in open source projects though, depending on the structure and size of a project. If no official style guide exists, the graceful thing to do is to simply adopt the code base’s current style when contributing to it. But larger projects that are accustomed to a multitude of random contributors will typically have one defined, which was either worked out by the core developers, or declared by its benevolent dictator for life.

In case of the Linux kernel, that’s of course [Linus Torvalds], who has recently shaken up the community with a mailing list response declaring an overly common, often even unwritten rule of code formatting as essentially obsolete: the 80-character line limitation. Considering the notoriety of his rants and crudeness, his response, which was initiated by a line break change in the submitted patch, seems downright diplomatic this time.

[Linus]’ reasoning against a continuing enforcement of 80-char line limits is primarly the fact that screens are simply big enough today to comfortably fit longer lines, even with multiple terminals (or windows) next to each other. As he puts it, the only reason to stick to the limitation is using an actual VT100, which won’t serve much use in kernel development anyway.

Allowing longer lines on the other hand would encourage the use of more verbose variable names and whitespace, which in turn would actually increase readability. Of course, all to a certain extent, and [Linus] obviously doesn’t call for abolishing line breaks altogether. But he has a point; does it really make sense to stick to a decades old, nowadays rather arbitrary-seeming limitation in 2020?

Continue reading “Ask Hackaday: Are 80 Characters Per Line Still Reasonable In 2020?”

Obstacle Avoidance For Drones, Learned From Mosquitoes

Our understanding of the sensory capabilities of animals has a lot of blanks, and often new discoveries serve as inspiration for new technology. Researchers from the University of Leeds and the Royal Veterinary College have found that mosquitos can navigate in complete darkness by detecting the subtle changes in the air flow created when they fly close to obstacles. They then used this knowledge to build a simple but effective sensor for use on drones.

Extremely sensitive receptors at the base of the antennae on mosquitoes’ heads, called the Johnston’s organ, allow them to sense these tiny changes in airflow. Using fluid dynamics simulations based on high speed photography, the researchers found that the largest changes in airflow occur over the mosquito’s head, which means the receptors are in exactly the right place. From their data, scientists predict that mosquitos could possibly detect surfaces at a distance of more than 20 wing lengths. Considering how far 20 arm lengths is for us, that’s pretty impressive. If you can get past the paywall, you can read the full article from the Science journal.

Using their newfound knowledge, the researchers equipped a small drone with probe tubes connected to differential pressure sensors. Using these sensors the drone was able to effectively detect when it got close to the wall or floor, and avoid a collision. The sensors also require very little computational power because it’s only a basic threshold value. Check out the video after the break.

Although this sensing method might not replace ultrasonic or time-of-flight sensors for drones, it does show that there is still a lot we can learn from nature, and that simpler is usually better. We’ve already seen simple insect-inspired navigation for drone swarms, as well as an optical navigation device for humans that works without satellites and only requires a view of the sky. Thanks for the tip [Qes]! Continue reading “Obstacle Avoidance For Drones, Learned From Mosquitoes”

Print-in-Place Helping Hand Grabs A Hold Of Your PCB

We probably don’t have to promote the benefits of a third hand or PCB holders in general, such is their obvious utility. While you can arrange some boxes and pile up tools on your bench to get a similar result, a good grip and flexibility to move the PCB around during soldering or performing any other work on it makes life just so much easier. Thanks to 3D printing there have been plenty of inspiring designs that go beyond the usual clumsy-yet-cheap croc clip version of it, and [SunShine] adds one on to the list with his spring-loaded print-in-place PCB gripper, demonstrated in this video and available on Thingiverse.

The gripping part’s design is based on a spring-loaded box [SunShine] created a little while back — which you can read more about in his Instructable. The holder itself comes in two varieties: one that brings its own stand, and one that has a GoPro mount. The first one is really more to show off the design, and while the gripping part is fully functional, it might not perform too well with heavier boards and easily tip over. Sure, a bigger bottom or mounting it to something more sturdy will fix that, but so will the GoPro-mount version, which also adds the whole flexibility aspect.

If you do prefer something standing more sturdily on your desk though, have a look at the concrete-mounted solder squid from earlier this year. And if you’re interested in more of [SunShine]’s work, check out his 3D-printed brush collection.

Continue reading “Print-in-Place Helping Hand Grabs A Hold Of Your PCB”

Arduino Magnetic Board Is Anything But Boring

Magnets (especially those ball magnets!) are endlessly fascinating, aren’t they? It’s almost dangerous to combine them with LEDs, because how are you supposed to get anything done with something like [andrei.erdei]’s Arduino Magnetic Board beckoning from beyond your keyboard?

This tons-of-fun board uses ball magnets to light up RGB LEDs as they roll around on the sexy Plexiglas field. Underneath the LED matrix is an orchestra of 36 reed switches — those little glass gas-filled grains of rice with axial leads that snap together or fly apart in the presence of magnetic fields. The LEDs are controlled with an Arduino Pro Mini, and so is the 8Ω speaker for sound effects.

[andrei.erdei] has already developed a few applications for this delightful desk toy, and they’re all on GitHub. There’s a chase game that involves tilting the board to catch the next red dot with the magnet, a light painting game, and a sequencer that mimics the ToneMatrix. Roll past the break to check out the series of short demo videos.

Want to play with reed switches but can’t source any at the moment? You could just make them yourself.

Continue reading “Arduino Magnetic Board Is Anything But Boring”

School’s In Session With HackadayU

The global COVID-19 pandemic has kept many of us socially isolated from friends, family, and colleagues for several months at this point. But thanks to modern technology, the separation has only been in the physical sense. From job interviews to grade school book reports, many of the things we’d previously done in person are now happening online. The social distancing campaign has also shown that virtual meetups can be a viable alternative to traditional events, with several notable hacker conventions already making the leap into cyberspace.

With this in mind, we’re proud to announce HackadayU. With weekly online videos and live office hours, these online classes will help you make the most of your time in isolation by learning new skills or diving deeper into subjects with experienced instructors from all over the world. Whether you’re just curious about a topic or want to use these classes to help put yourself on a new career path, we’re here to help.

In a community like ours, where so many people already rely on self-study and tutorial videos, these four week classes are perfect for professional engineers and hobbyists alike. To make sure HackadayU is inclusive as possible, classes will be offered on a pay-as-you-wish basis: we’ll pick up the tab for the instructor’s time, and you kick in whatever you think is fair. All money collected will be donated to charities that help feed, house, and educate others. We know these are tough times, and the hope is that HackadayU can not only benefit the members of our core community, but pass on some goodwill to those who are struggling.

Classes will be rolling out through the rest of 2020, but here’s a look at some of what we’ve got planned: Continue reading “School’s In Session With HackadayU”

Surviving The Pandemic As A Hacker: Take Care Of Your Mental Health

As we’ve looked at the subject of face masks in the first two parts of this series, our emphasis has been on a physical step to aid your chances of making it through the COVID-19 pandemic in one piece. But given that the upheaval caused by all the social changes enacted to protect the population are likely to leave an indelible mark on those who live through them, there are significant aspects of surviving all this that go beyond the physical.

This will be a once-in-a-lifetime event for many people, a significant number will find it traumatic in some way, and for many of those people there will be an immediate and then ongoing effect on mental health. If anyone is in doubt as to from what position this is coming, I count myself among that number.

The Pressure Of A Once In A Lifetime Event

Piccadilly Circus, London, during the COVID-19 lockdown. Normally this is packed.
Piccadilly Circus, London, during the COVID-19 lockdown. Normally this is packed. Kwh1050 / CC BY-SA 4.0

Different countries have placed their own public health restrictions on their populations, but it’s likely that many of you are in some form of lockdown situation, with social or communal  activities and locations closed or curtailed, going out restricted, and with all around you in the same situation. A perfect storm of having social outlets removed while simultaneously being stuck at home perhaps with family or housemates you’d prefer not to spend too much time with is not ideal. Add to that the multiple stresses from the pandemic itself as well as other news stories from our turbulent world, and it’s hardly a surprising that it’s taking a toll. Continue reading “Surviving The Pandemic As A Hacker: Take Care Of Your Mental Health”