Micropython And C Play Together Better

Python is a versatile, powerful language but sometimes it’s not the best choice, especially if you’re doing work in embedded systems with limited memory. Sometimes you can get away with MicroPython for these cases, but the best language is likely C or assembly. If you’re really stubborn, like [amirgon], and really want C and Python to play well together, you can make use of his new tool which can bring any C library to MicroPython.

As an example of how this tool is used, a “Pure MicroPython” display driver for ILI9341 on the ESP32, which means that everything was implemented in MicroPython. [amirgon] wanted to see how the Python driver would compare to one that’s already been written in C, and use it to showcase MicroPython binding. This tool also automatically converts structs, unions, enums and arrays to Python objects, and provides a means to work with pointers which is something that Python doesn’t handle in the same way that C requires.

[amirgon] hopes that this tool will encourage the adoption of Micropython by removing the obstacle of missing APIs and libraries in MicroPython. Since most libraries for systems like these are written in C, a way to implement them in Python is certainly powerful. We featured one use case for this a while back, but this is a much more generic fix for this coding obstacle.

Spot Adulterated Olive Oil With This Spectrophotometer

Olive oil at its finest quality is a product that brings alive the Mediterranean cuisine of which it is a staple. Unfortunately for many of us not fortunate enough to possess our own olive grove, commercial olive oils are frequently adulterated, diluted with cheaper oils such as canola. As consumers we have no way of knowing this, other than the taste being a bit less pronounced. Food standards agencies use spectrophotometers to check the purity of oils, and [Daniel James Evans] has created such a device using a Raspberry Pi.

A spectrophotometer shines white light through a sample to be tested, splits the light up into a spectrum with a prism or diffraction grating, and measures the light level at each point in the spectrum to gain a spectral profile of the sample. Different samples can then be compared by overlaying their profiles and looking at any differences. This build shines the light from an LED through a sample of oil, splits the result with a diffraction grating, and captures the spectrum with a Raspberry Pi camera. Commercial instruments are usually calibrated by co-incidentally sampling a pure sample of the same solvent the test subject is dissolved in, in this case the calibration is done against a sample of pure olive oil. The software requires the user to identify the spectrum in the resulting photograph, before generating a curve.

From a basis of having worked with and maintained spectrophotometers in the distant past we would have expected to see an incandescent bulb rather than an LED for a flatter response, but since this is an oil identifier rather than a finely calibrated laboratory instrument this is probably less of an issue.

Over the years we’ve had quite a few spectrophotometer projects here, this Hackaday Prize entry from 2016 is just one of many.

Odd-Sized Military Headphone Connectors, Tamed!

Military headphones, at least the older ones, are like few other sound reproducers. They are an expression of function over form, with an emphasis on robustness over operator comfort. Electrically they most often have high-impedance drivers and annoyingly proprietary connectors for whichever obscure radio system they were a part of.

[John Floren] has a HS-16A headset, the type used by the US military during the Vietnam war. It’s an antiquated design with a dual spring steel headband and on-the-ear ‘phones with no muff for comfort, and a quick bit of research finds that they can be had brand new in their 1960s packaging for somewhere around $20. Their connector is a pair of odd metal pins, and rather than doing what most of us would do and snipping the wire to fit something more useful, he hunted high and low for a TE Connectivity receptacle that would fit them. A short extension and a jack plug allowed him to use these slightly unusual cans.

This isn’t a special hack, but it’s still an interesting read because it sheds a bit of light upon these old-style headphones and reveals that they’re still available for anyone who wants their radio operating to have a retro feel. If you buy a set, you’ll probably still have them decades after more modern pairs have bitten the dust.

AI Poised To Turn The Internet Into Gibberish

Last Thursday two lowly masters grad students, Aaron Gokaslan and Vanya Cohen managed to replicate the secretive OpenAI model and cheekily named their version OpenGPT-2. The code can be downloaded from this Google Colab page and apparently no prior experience in language modeling is required to use it. More useful might be the skills required to persuade Google to part with $50,000 worth of free cloud compute time for the training!

Research firm OpenAI released a new, ever more powerful, version of their GPT language model with 1.5 billion parameters, trained on a data-set of 8 million web pages and although it’s most entertaining use is to produce gibberish, it will inevitably also be able to produce coherent text sometime very soon. For us mere mortals, there’s a cut down version of the model hosted in the cloud and a webpage that we can visit, type in a short phrase to prompt the system, and print out a few paragraphs of fake news. We tried it with the following: “You can use an Arduino to” and the results were:

  • You can use an Arduino to remove your appendix. Use an open or closed loop, but do not use them at the same time, i.e. don’t wire your Arduino to the wall like I did. The Arduino’s are very noisy and can damage the circuit board. Be sure to use a good quality and high-quality resistor to connect them to the wall. You can also use your own antenna if you’d like.

The neural network works by taking the text that has been previously printed and using this to predict the next word sequentially. Because of it’s obscurity, our Arduino example is a pretty severe and rather unfair test on the system whilst in it’s fledgling infant state and, looking at the proper metrics, it actually performs quite well on certain standard industry test sets such as the Children’s Book Test.

Be sure to paste your own fake news into the comments below and we’ll take a vote on the one that’s most entertaining, but please keep it within the boundaries of good taste!

Whilst this is an emerging technology, somebody did get hold of it a while back and applied it to an old teleprinter!

 

Steampunk Radio Looks The Business

Radios are, by and large, not powered by steam. One could make the argument that much of our municipal electricity supply does come via steam turbines, but that might be drawing a long bow. Regardless, steampunk remains a popular and attractive aesthetic, and it’s the one that [Christine] selected for her radio build.

The build cribs from [Christine’s] earlier work on a VFD alarm clock, using similar tubes and driver chips to run the display. FM radio and amplification are courtesy of convenient modules. Tubes are fitted for aesthetic purposes, artfully lit with a smattering of color-changing LEDs. Perhaps the neatest touch is the use of valve handles to control tuning and volume. A stepper motor turns a series of gears, as is mandatory for any true steampunk build, and there’s even an electromagnetic actuator to make the Morse key move. To run it all, a pair of Arduino Megas are charged with handling the I/O needs of all the various systems.

It’s a fancy build that shows how far the rabbit hole you can go when chasing a particular look and feel. It’s a radio that would make a great conversation piece on any hacker’s coffee table.  If that’s not enough, consider going for a whole laptop. Video after the break. Continue reading “Steampunk Radio Looks The Business”

Voice Chess Uses Phone, Arduino, And An Electromagnet

[Diyguypt] may be an altruist to provide the means for people who can’t manipulate chess pieces to play the game. Or he may just have his hands too busy with food and drink to play. Either way, his voice command chessboard appears to work, although it has a lot of moving parts both figuratively and literally. You can check out the video below to see how it works.

The speech part is handled by an Android phone and uses Google’s voice services, so if you don’t want Google listening to your latest opening gambit, you’ll want to pass this one up. The phone uses an app that talks to the Arduino via Bluetooth, which means the Arduino needs a Bluetooth module.

Continue reading “Voice Chess Uses Phone, Arduino, And An Electromagnet”

ReMarkable Tablet Scores A MicroSD Slot

There’s been a marked trend towards modern tablets and phones having fewer expansion options. It’s becoming rarer to find a microSD slot available, which can be particularly frustrating. For [davisr], this simply wouldn’t do, and they set about hacking their ReMarkable tablet.

A rotary tool was used to make a tidy slot for the microSD card.

The ReMarkable already has a set of pads for an SDHC interface on the main board, ready to go. Despite this, both hardware and software modifications are required to get things up and running. [davisr] started by soldering some wires to the main board, feeding them to a microSD socket, which was mounted on the edge of the tablet in a convenient nook. The case was then delicately modified to make a slot for cards to be inserted and removed. With this done, the kernel was then recompiled to enable support for the SDHC interface, and everything was up and running.

With the modification in place, [davisr] now has over 150GB of storage available, which should last for quite some time. Similar hacks are possible on other platforms, too. Even the Pi Zero can mount a second SD card with the right mods!