Building A Pocket Sized Python Playground

Like many of us, [Ramin Assadollahi] has a certain fondness for the computers of yesteryear. Finding his itch for nearly instant boot times and bare metal programming weren’t being adequately scratched by any of his modern devices, he decided to build the PortablePy: a pocket-sized device that can drop him directly into a Python prompt wherever and whenever the urge hits him.

The device is powered by the Adafruit PyPortal Titano, which combines a ATSAMD51J20, ESP32, an array of sensors, and a 3.5″ diagonal 320 x 480 color TFT into one turn-key unit. The PyPortal is designed to run CircuitPython, but the scripts are usually dropped on the device over USB. That’s fine for most applications, but [Ramin] wanted his portable to be usable without the need for a host computer.

For a truly mobile experience, he had to figure out a way to bang out some Python code on the device itself. The answer ended up being the M5Stack CardKB, a tiny QWERTY board that communicates over I2C. Once he verified the concept was sound, he wrote a simple file management application and minimal Python editor that could run right on the PyPortal.

The final step was packaging the whole thing up into something he could actually take off the bench. He designed a 3D printed clamshell case inspired by the classic Game Boy Advance SP, making sure to leave enough room in the bottom half to pack in a charging board and LiPo pouch battery. He did have to remove some of the connectors from the back of the PyPortal to get everything to fit inside the case, but the compact final result seems worth the effort.

While an overall success, [Ramin] notes there are a few lingering issues. For one thing, the keyboard is literally a pain to type on. He’s considering building a custom keyboard with softer buttons, but it’s a long-term goal. More immediately he’s focusing on improving the software side of things so its easier to write code and manage multiple files.

It sounds like [Ramin] isn’t looking to compromise on his goal of making the PortablePy completely standalone, but if your convictions aren’t as strong, you could always connect a device like this up to your mobile to make things a bit easier.

Continue reading “Building A Pocket Sized Python Playground”

Implementing SENT Sensors On The Raspberry Pi

The SENT protocol, standing for Single Edge Nibble Transmission, is used for sensors that need to send high-resolution data while keeping system costs low. It’s most typically used in the automotive world, where it can be found in such parts as throttle-by-wire pedals and temperature sensors. [Mark Smith] set out to see if he could get the Pi Zero to read such sensors without the use of an intermediate microcontroller.

[Mark]’s initial attempts relied on Python and the RPI.GPIO library. Unfortunately, the overheads introduced made decoding SENT traffic impossible. Undeterred, [Mark] pressed on, leveraging the pigpio library and its callback function which allowed sampling at up to one microsecond. This was fast enough to read the messages from a LX3302A inductive position sensor that uses the protocol.

It’s a project that could prove useful for those trying to work with certain sensors who want to avoid adding complexity to a Raspberry Pi project. Files are available on Github for the curious. We’ve seen other direct sensor builds with the Pi, before too – like this power monitoring system. Video after the break.

Continue reading “Implementing SENT Sensors On The Raspberry Pi”

Remoticon Video: Learn How To Hack A Car With Amith Reddy

There was a time not too long ago when hacking a car more often than not involved literal hacking. Sheet metal was cut, engine cylinders were bored, and crankshafts were machined to increase piston travel. It was all in the pursuit of milking the last ounce performance out of every drop of gasoline, along with a little personal expression in the form of paint and chrome.

While it’s still possible — and encouraged — to hack cars thus, the inclusion of engine control units and other systems to our rides has created an entirely different universe of car hacking options, which Amith Reddy distilled into his very popular workshop at the 2020 Remoticon. The secret sauce behind all the hacks you can accomplish in today’s drive-by-wire cars is the Controller Area Network (CAN), the network used to connect the array of sensors, actuators, and controllers that lie under the metal and plastic of modern cars.

Continue reading “Remoticon Video: Learn How To Hack A Car With Amith Reddy”

TMD-2: A Bigger, Better, More Collaborative Turing Machine

One of the things we love best about the articles we publish on Hackaday is the dynamic that can develop between the hacker and the readers. At its best, the comment section of an article can be a model of collaborative effort, with readers’ ideas and suggestions making their way into version 2.0 of a build.

This collegial dynamic is very much on display with TMD-2, [Michael Gardi]’s latest iteration of his Turing machine demonstrator. We covered the original TMD-1 back in late summer, the idea of which was to serve as a physical embodiment of the Turing machine concept. Briefly, the TMD-1 represented the key “tape and head” concepts of the Turing machine with a console of servo-controlled flip tiles, the state of which was controlled by a three-state, three-symbol finite state machine.

TMD-1

TMD-1 was capable of simple programs that really demonstrated the principles of Turing machines, and it really seemed to catch on with readers. Based on the comments of one reader, [Newspaperman5], [Mike] started thinking bigger and better for TMD-2. He expanded the finite state machine to six states and six symbols, which meant coming up with something more scalable than the Hall-effect sensors and magnetic tiles of TMD-1.

TMD-2 has a camera for computer vision of the state machine tiles

[Mike] opted for optical character recognition using a Raspberry Pi cam along with Open CV and the Tesseract OCR engine. The original servo-driven tape didn’t scale well either, so that was replaced by a virtual tape displayed on a 7″ LCD display. The best part of the original, the tile-based FSM, was expanded but kept that tactile programming experience.

Hats off to [Mike] for tackling a project with so many technologies that were previously new to him, and for pulling off another great build. And kudos to [Newspaperman5] for the great suggestions that spurred him on.

Chess Computer Retires To Play Jazz

Years ago, [Leo Neumann]’s girlfriend gave him a 1970s chess computer game that was missing almost everything but the super cool clicky keyboard. Noting the similarity of chess move labeling to chord notation, [Leo] decided to turn it into something even nerdier — a jazz chord game where you jam with the computer.

To play the game, you and the computer take turns entering jazz chords that progress musically from the last one played. The hardware is simple — a Raspberry Pi Zero and a WM8960 audio hat with amplifier in speakers. [Leo] also put in a slightly larger display than the original and printed a new bottom half for the case. We love the look of this build, especially the groovy custom line font [Leo] designed.

On the software side, [Leo] made a Python prototyping environment using PYO Module and Kivy UI. Not content with other approaches to tonal consonance, [Leo] played a couple thousand chords and rated them according to their progressive harmony. Shake out those jazz hands and check it out after the break.

Want to play chess with computers? Make Alexa your go-between.

Continue reading “Chess Computer Retires To Play Jazz”

A Computer In The Game Of Life

We often hear the term “Turing-complete” without giving much thought as to what the implications might be. Technically Microsoft PowerPoint, Portal 2, and Magic: the Gathering all are Turing-complete, what of it? Yet, each time someone embarks on an incredible quest of perseverance and creates a computer in one of these mediums, we stand back in awe.

[Nicolas Loizeau] is one such individual who has created a computer in Conway’s Game of Life. Unlike electricity, the Game of Life uses gliders as signals. Because two orthogonal gliders can cancel each other out or form a glider eater if they intersect with a good phase shift, the basic logic gates can be formed from these interactions. This means the space between gates is crucial as signals need to be in phase alignment. The basic building blocks are a period-60 gun, a 90-degree glider reflector, a glider duplicator, and a glider eater.

All the Python code that generates these structures is on GitHub as the sheer size of the machine couldn’t possibly be placed by hand. The Python includes scripts to assemble the basic programs as a bank of selectable glider generators. It’s all based on Golly, which is an excellent program for simulating Conway’s Game of Life, among other things. While this isn’t the first computer in the Game of Life as [Paul Rendell] published a design in 2000 and [Adam Goucher] published a Spartan universal computer constructor in 2009, we think this is a particularly beautiful one.

The actual architecture has an 8-bit data bus, a 64-byte memory with two read ports, a ROM with 21 bits per line, and a one-hot encoded ALU supporting 8 different operations. Instructions have a 4-bit opcode which is decoding in a few different instructions. The clock is four loops, formed by the glider reflectors as the glider beams rotate. This gives the computer four stages: execution, writing, increment PC, and write PC to memory.

The Game of Life is an excellent example of Cellular Automaton (CA). There are several other types of CA’s and the history behind them is fascinating. We’ve covered this field before and delved into this beautiful fringe of computer science. Check out the video below to truly get a sense of the scale of the machine that [Nicolas] has devised.

Continue reading “A Computer In The Game Of Life”

FreeCAD Debugging

Powerful software programs often have macro programming languages that you can use, and if you know how to program, you probably appreciate them. However, sometimes the program’s built-in debugging facilities are lacking or even nonexistent If it were just the language, that wouldn’t be such a problem, but you can’t just grab a, for example, VBA macro from Microsoft Word and run it in a normal Basic interpreter. Your program will depend on all sorts of facilities provided by Word and its supporting libraries. [CrazyRobMiles] was frustrated with trying to debug Python running inside FreeCAD, so he decided to do something about it.

[Rob’s] simple library, FakeFreeCad, gives enough support that you can run a FreeCAD script in your normal Python development environment. It only provides a rude view of what you are drawing, but it lets you explore the flow of the macro, examine variables, and more.

Continue reading “FreeCAD Debugging”