Accurate Cycle Counting On RP2040 MicroPython

The RP2040 is a gorgeous little chip with a well-defined datasheet and a fantastic price tag. Two SDKs are even offered: one based on C and the other MicroPython. More experienced MCU wranglers will likely reach for the C variant, but Python does bring a certain speed when banging out a quick project or proof of concept. Perhaps that’s why [Jeremy Bentham] ported his RP2040-based vehicle speedometer to MicroPython.

The two things that make that difficult are that MicroPython tries to be pretty generic, which means some hackery is needed to talk to the low-level hardware, and that MicroPython doesn’t have a reputation for accurate cycle counting. In this case, the low-level hardware is the PWM peripheral. He details the underlying mechanism in more detail in the C version. On the RP2040, the PWM module can count pulse edges on an input. However, you must start and stop it accurately to calculate the amount of time captured. From there, it’s just edges divided by time. For this, the DMA system is pulled in. A DMA request can be triggered once the PWM counter rolls over. The other PWM channel acts as a timer, and when the timer expires, the DMA request turns off the counter. This works great for fast signals but is inaccurate for slow signals (below 1kHz). So, a reciprocal or time-interval system is included, where the time between edges is captured instead of counting the number of edges in a period,

What’s interesting here is how the hardware details are wrapped neatly into pico_devices.py. The uctypes module from MicroPython allows access to MMIO devices such as DMA and PWM. The code is available on GitHub. Of course, [Jeremy] is no stranger to hacking around on the RP2040, as he has previously rolled his own WiFi driver for the Pico W.

Going To Extremes To Block YouTube Ads

Many users of YouTube feel that the quality of the service has been decreasing in recent years — the platform offers up bizarre recommendations, fails to provide relevant search results, and continues to shove an increasing amount of ads into the videos themselves. For shareholders of Google’s parent company, though, this is a feature and not a bug; and since shareholder opinion is valued much more highly than user opinion, the user experience will likely continue to decline. But if you’re willing to put a bit of effort in you can stop a large chunk of YouTube ads from making it to your own computers and smartphones.

[Eric] is setting up this adblocking system on his entire network, so running something like Pi-hole on a single-board computer wouldn’t have the performance needed. Instead, he’s installing the pfSense router software on a mini PC. To start, [Eric] sets up a pretty effective generic adblocker in pfSense to replace his Pi-hole, which does an excellent job, but YouTube is a different beast when it comes to serving ads especially on Android and iOS apps. One initial attempt to at least reduce ads was to subtly send YouTube traffic through a VPN to a country with fewer ads, in this case Italy, but this solution didn’t pan out long-term.

A few other false starts later, all of which are documented in detail by [Eric] for those following along, and eventually he settled on a solution which is effectively a man-in-the-middle attack between any device on his network and the Google ad servers. His router is still not powerful enough to decode this information on the fly but his trick to get around that is to effectively corrupt the incoming advertising data with a few bad bytes so they aren’t able to be displayed on any devices on the network. It’s an effective and unique solution, and one that Google hopefully won’t be able to patch anytime soon. There are some other ways to improve the miserable stock YouTube experience that we have seen as well, like bringing back the dislike button.

Thanks to [Jack] for the tip!

GTA 6 Hacker Found To Be Teen With Amazon Fire Stick In Small Town Hotel Room

International cybercrime, as portrayed by the movies and mass media, is a high-stakes game of shadowy government agencies and state-sponsored hacking groups. Hollywood casting will wheel out a character in a black hoodie and shades, probably carrying a metallic briefcase as they board an executive jet.

These things aren’t supposed to happen in a cheap hotel room in your insignificant hometown, but the story of a British teen being nabbed leaking the closely guarded details of Grand Theft Auto 6 in a Travelodge room in Bicester, Oxfordshire brings the action from the global into the local for a Hackaday scribe. Bicester is a small town best known for a tacky outlet mall and as a commuter dormitory stop on the line to London Marylebone, it’s not exactly Vice City.

The teen in question is one [Arion Kurtaj], breathlessly reported by the BBC as part of the Lapsus$ gang, which is a sensationalist way of talking up a group of kids expert at computer infiltration but seemingly inept at being criminals. After compromising British telcos he was exposed by another group and nabbed by the authorities, before being moved to the hotel for his own safety.

Here the story becomes more interesting for Hackaday readers, because though denied access to a computer he purchased an Amazon Fire stick presumably at the Argos in the Sainsburys next door, and plugged it into the Travelodge TV. Using this he was able to access cloud services, we’re guessing a virtual Linux environment or similar, before continuing to compromise further organisations including Rockstar Games to leak that GTA 6 footage. He’s yet to be sentenced, but we’re guessing that he’ll continue to spend some time at His Majesty’s pleasure.

The moment of excitement in one’s hometown and the sensationalist reporting aside, we can’t help feeling sad that a teen with that level of talent evidently wasn’t given the support and encouragement by Oxfordshire’s education system necessary to put it to better use. Let’s hope when he’s older and wiser the teenage conviction won’t prevent him from having a useful career in the field.

Kitchen Steganography With Turmeric

It is a classic rite of passage for nerdy kids to write secret messages using lemon juice. If you somehow missed that, you can’t see the writing until you heat the paper up with, say, an old-fashioned light bulb. If you were a true budding spy, you’d write a boring normal letter with wide spacing and then fill in the blanks between the lines with your important secrets written in juice. This is a form of steganography — encoding secret messages by hiding them in plain sight. [Randomona] shares a different technique that seems to be way cooler than lemon juice using, of all things, turmeric. This isn’t like the invisible ink of our childhood.

That’s probably a good thing. We doubt an LED bulb makes enough heat to develop our old secret messages. [Ranomona’s] ink doesn’t use heat, but it uses a developer. That means you must make two preparations: the ink and the developer. The results are amazing, though, as shown in the video below.

Continue reading “Kitchen Steganography With Turmeric”

Impulse Buying A 3040 CNC Machine, What Could Go Wrong?

[joekutz] made an impulse purchase of a CNC machine. It was a 3040 CNC that looked reasonably complete and had an attractive price, what could possibly go wrong? As it happens, [joekutz] really didn’t know what he was in for. Sometimes the price is good, but you pay in other ways. But where some would see defeat, [joekutz] sees an opportunity to document the restoration.

Dial indicators are useful tools for measuring how straight some parts aren’t.

The 3040 are relatively cheap and simple CNC machines that have been available from a variety of overseas retailers for years. They have 30 cm by 40 cm beds (hence the name) and while there are many variations, they all work about the same. [joekutz] expected that getting his up and running and converted to open source would be a fun weekend project, but it ended up taking far longer than that. In fact, it turns out that the machine was damaged in surprising and unexpected ways.

[joekutz] has a series of videos demonstrating the process of diagnosing and repairing the various things wrong with this device. In the first video, he dismantles the machine and discusses the next steps. In the second video, he takes some time to repair some dial indicators that will be critical for measuring the various things wrong with the CNC parts. Video number three delves into finding out the horrible things wrong with the machine, and the fourth is where repairs begin, including bending shafts and sanding blocks back into service.

Those videos are embedded below, and while the machine isn’t quite restored yet, progress is promising. We’ve seen easy and effective upgrades for such CNC machines before, but if you happen to be in more of a repair and restore situation, give [joekutz]’s work a look because it might just save you some time and frustration.

Continue reading “Impulse Buying A 3040 CNC Machine, What Could Go Wrong?”

How Do They Do That?

Last week’s Chaos Communication Camp is kinda a big deal: 6,000 hackers all out in a field all need power, food, drink, networking, and of course, sewage in the middle of nowhere. Oh yeah, plus video services on multiple simultaneous stages, custom phone infrastructure, a postal service, and even a diesel train. How is that even possible to run with only volunteers? How do they even know how to run something this scale?

My wife asked me this question while we were driving up to Berlin, and the answer is of course the same as it is to “Excuse me, can you tell me how to get to Carnegie Hall?” Practice.

But it’s not just practice. It’s also passing down the lessons learned to the next generation, making procedures that are not 100% dependent on the people doing the jobs, but can be passed on to the next volunteer willing to pick up the torch.

And then I was interviewing [Jens Ohlig] and [Mitch Altman] about the early days of the second wave hackerspaces in America for the podcast. (Some great interviews – go check it out!) The central story there is essentially the same: the critical missing ingredient that lead to the blossoming of US hackerspaces was simply a set of instructions and design principles – drawing on the experience of established hackerspaces.

Sharing information is a fundamental cornerstone of the hacker ethic, and it gives the next hacker a leg up. Contributes to the global hive mind. And it makes things possible that would otherwise seem impossible. Pushing the hacker state-of-the-art is what Hackaday is all about, and we’re used to thinking of it in terms of a particular microcontroller library, but seeing how the same sharing makes impossible logistics possible was inspirational. Don’t be afraid to start small and iterate – and take good notes.

2023 Cyberdeck Challenge: KOAT0 Portable Terminal

We’ve had cyberdecks as part of the scenery for long enough now that there are a series of common elements that appear across many different builds. The Raspberry Pi, for instance, or the mechanical keyboard, with a 3D printed body. [RobsonCuto]’s KOAT0 Portable Terminal has some of those in a particularly slim and neat design. The orange and grey color scheme is great really pops. Where this deck really shines though, is the display.  He’s eschewed LCDs or OLEDs, even CRTs, and gone for an unusual choice in a dot-matrix VFD.

The VFD in question is commonly available on AliExpress where it appears to be used for displaying Chinese characters. It’s not an obvious choice for a cyberdeck, so once the tidy-looking case is complete the real challenge in this project becomes how to drive it from the Pi. To that end, he appears to have some kind of text output working but still needs to complete a framebuffer driver. We applaud the effort and we really like the display.  We’re curious as to how its meager resolution might best be used in a Linux device.

All in all, this is a ‘deck we’d be happy to use ourselves if it were an option. We particularly like the on-the-arm style of use, and we’re pretty sure it’s the first time we’ve seen one of these displays on these pages.