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?”

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”

Samsung’s Leap Month Bug Teaches Not To Skimp On Testing

Date and time handling is hard, that’s an ugly truth about software development we’ll all learn the hard way one day. Sure, it might seem like some trivial everyday thing that you can easily implement yourself without relying on a third-party library. I mean, it’s basically just adding seconds on top of one another, roll them over to minutes, and from there keep rolling to hours, days, months, up until you hit the years. Throw in the occasional extra day every fourth February, and you’re good to go, right?

Well, obviously not. Assuming you thought about leap years in the first place — which sadly isn’t a given — there are a few exceptions that for instance cause the years 1900 and 2100 to be regular years, while the year 2000 was still a leap year. And then there’s leap seconds, which occur irregularly. But there are still more gotchas lying in wait. Case in point: back in May, a faulty lunar leap month handling in the Chinese calendar turned Samsung phones all over China into bricks. And while you may not plan to ever add support for non-Gregorian calendars to your own project, it’s just one more example of unanticipated peculiarities gone wild. Except, Samsung did everything right here.

So what happened?

Continue reading “Samsung’s Leap Month Bug Teaches Not To Skimp On Testing”

Defeating Fridge DRM With Duct Tape And A Dremel

We love writing about DRM here at Hackaday. Because when we do, it usually means someone found a way to circumvent the forced restrictions laid upon by a vendor, limiting the use of a device we thought is ours once we bought it. The device in question this time: the water filter built into GE’s fridges that would normally allow its “owner” to pour a refreshing glass of cold water. Except the filter is equipped with an RFID tag and an expiration, which will eventually deny you that little luxury. And if that’s already a feature, you can bet it won’t just let you insert any arbitrary filter as replacement either.

Enraged by every single aspect of that, [Anonymous] made a website to vent the frustration, and ended up tearing the culprit apart and circumvent the problem, with a little help from someone who was in the same situation before. As it turns out, the fridge comes with a “bypass filter” that is just a piece of plastic to fit in place of the actual filter, to pour unfiltered, but still cold water. That bypass filter is also equipped with an RFID tag, so the reader will recognize it as a special-case filter, which luckily enough doesn’t have an expiration counter.

The general idea is to take out that bypass filter’s RFID tag and place it on a generic, way cheaper filter to trick the fridge into thinking it simply doesn’t have a filter in the first place, while still enjoying the filters actual functionality. However, this might not be the most stable solution if the tag isn’t placed in the exact position. Also, retrieving the tag in the first place proved tricky, and [Anonymous] initially ended up with nothing but the antenna pad, while the tag itself remained sturdily glued into the plastic piece.

Continue reading “Defeating Fridge DRM With Duct Tape And A Dremel”

Arduino Music Box Turns Stuffed Animal Into TV Personality

Childlike imagination is a wonderful thing. The ability to give life to inanimate objects and to pretend how they’re living their own life is precious, and not for nothing a successful story line in many movies. With the harsh facts or adulthood and reality coming for all of us eventually, it’s nice to see when some people never fully lose that as they get older. Even better when two find each other in life, like [er13k] and his girlfriend, who enjoy to joke about all the mischief their giant dog-shaped plush toy [Tobias] might secretly get into in their absence. The good thing about growing up on the other hand is the advanced technical opportunities at one’s disposal, which gave the imagined personality an actual face, and have it live inside an old CRT screen.

The initial idea was to just build a little music box as a gift, which beeps out [er13k]’s girlfriend’s favorite song with an Arduino on a speaker he salvaged from an old radio. But as things tend to go when you’re on a roll, he decided to make the gift even more personal. The result is still that music box, built in a 3D-printed case with a little piano that lights up the notes it plays, but in addition the Arduino now also displays a cartoon version of [Tobias] through composite video on an old TV. You can see for yourself in the video after the break how he goes through the day gifting flowers and drawings, and ponders about work and alternative career plans — adult problems are clearly universal.

Sure, the music box sound is a bit one-dimensional, but it’s nevertheless a highly thoughtful gift idea that triumphs with a peak personalization factor. If [er13k] ever wants to change the sound though, maybe there’s some inspiration in this drum machine we’ve seen just a few weeks ago, or this pocket sampler.

Continue reading “Arduino Music Box Turns Stuffed Animal Into TV Personality”

Solving Buyer’s Remorse With A Rotary Tool And Soldering Iron

At this point, it’s pretty clear that USB-C has become the new standard connector for an increasing amount of applications, but predominantly charging. Even Apple is on board this time, and thanks to backwards compatibility, you don’t have to abandon devices using the older standards you may prefer for their simplicity or superior lint-resilience either. For [Mat] on the other hand, it’s USB-C all the way nowadays. Yet back in the day when he bought his laptop, he had the price tag convince him otherwise, and has come to regret it, as all the convenience of a slim design is cancelled out by dragging a bulky charger for the laptop’s proprietary charging port along.

Well, as the saying goes for situations like this: love it, leave it, or get out the tools and rework that sucker. Lucky enough, the original charger provides 20 V, which matches nicely the USB power delivery (PD) specification, and after opening up the laptop, [Mat] was happy to see that the interior provided enough room to fit the USB-C module he was planning to use. Even better, the charging port itself was a standalone component attached to a cable, so no modifications to the mainboard were necessary. Once the USB-C module was soldered to that same cable, the only thing left to do was carving a bigger hole on the laptop case, and saying good bye to the obsoleted charger.

The downside is of course the lack of actual USB functionality with that shiny new charging port, but that was never the goal here anyway. With more and more USB-C devices popping up, it’s also no surprise that we’ve seen modifications like this before, and not only with laptops. In case you’re thinking of upgrading one of your own devices to USB-C, and do wish for actual USB functionality, don’t worry, we got you covered as well.

Continue reading “Solving Buyer’s Remorse With A Rotary Tool And Soldering Iron”