Assembly Required: Subroutine Calls and the 1K Challenge

The first computer I personally owned had 256 bytes of memory. Bytes. The processor in my mouse and keyboard both have more memory than that. Lots more. Granted, 256 bytes was a bit extreme, but even the embedded systems I was building as part of my job back then generally had a small fraction of the 64K bytes of memory they could address.

Some people are probably glad they don’t have to worry about things like that anymore. Me, I kind of miss it. It was often like a puzzle trying to squeeze ten more bytes out of an EPROM to get a bug fix or a new feature put in. I though with the 1K challenge underway, I might share some of the tricks we used in those days to work around the small memory problems.

Continue reading “Assembly Required: Subroutine Calls and the 1K Challenge”

The ESP: A New 1kB Contender Appears

The ESP8266 is officially checking into the Hackaday 1kB Challenge. Doing something meaningful in 1kB of compiled code is tricky; modern SDKs like the ones often used for ESP8266 compile even the simplest programs to nearly that size. If you want to use this hardware in your 1kB Challenge entry, I have a solution for you!

The ESP8266 now has a barebones build environment focused on minimizing code size, as little as 131 bytes to boot up and blink an LED. It also “supports” some new, insane clock rates (like 346 MHz) and crazy development cycle speeds. The WiFi is stuck in “airplane mode,” but it will be worth your time to consider the ESP for the next non-WiFi project you’ll be doing.

Far too often, we follow design patterns that ‘just work’ instead of looking for the ones that are optimal because we’re afraid of wasting time. The benefits of keeping code tight and small are frequently overlooked. When code is small and environments minimal, RAM and FLASH become easier to come by, compiled binaries shrink and time wasted by compiling and flashing can decrease by an order of magnitude! We rarely see just how much value is added when we become a good engineer: being done only when there’s nothing left to remove from a design. Nosdk8266 will let you see what it’s like to test out code changes several times a minute.

Just a month ago, when preparing the ESP8266 for a USB bootloader, I had to make a stripped-down environment for it. It’s not based on the Official Non-OS SDK or the RTOS sdk, but an environment that can boot up and blink an LED. Not just blink an LED, but tweak the clock in some totally unexpected ways and even run the I2S bus (used for espthernet and Color NTSC Broadcast Video). If you’re not at the submission phase for your 1kB challenge, you can even use the mask ROM for printf! Now you can tweak your code and — in under 2 seconds — see what the new code does!

Even in PICO mode, the part still has to use the mask ROM to be loaded, but thankfully, the 1kB Challenge has added an exception for unavoidable bootloaders. No longer bound by the shackles of WiFi, I can’t wait to see what you’ll do with the ESP8266. Just beware that the processor may not work reliably when overclocked at 346 MHz (332.5%,) and you’ll certainly be voiding any warranties you may have. Sounds like fun, right?

Editorial Note: This is a guest article from Charles Lohr, aka [CNLohr]. Although he has written a few other guest articles, he is not a regular contributor to Hackaday and therefore, this article does not disqualify him from entering the 1kB Challenge. We felt it more fair to publish this article which shares the tools he’s using to make code smaller, rather than to keep them to himself for fear of disqualification. While we have your attention, we wanted to mention one of Charles’ articles which was published on April 1st — we still think there’s a lot of people who don’t realize it wasn’t a prank.

Step Up to the 1 kB Challenge

1 kilobyte. Today it sounds like an infinitesimally small number. Computers come with tens of gigabytes of ram, and multiple terabytes of storage space. You can buy a Linux computer with 1 gig of RAM and secondary storage as big as the SD card you throw at it. Even microcontrollers have stepped up their game, with megabytes of flash often available for program storage.

Rapidly growing memory and storage are a great testament to technology marching forward to the beat of Moore’s law. But, we should be careful not to forget the techniques of past hackers who didn’t have so much breathing room. Those were the days when code was written in assembly. Debugging was accomplished with an expensive ICE (an In Circuit Emulator… if you were working for a big company), or a few LEDs if you were hacking away in your basement.

To keep these skills and techniques in play, we’ve created The 1 kB Challenge, a contest where the only limit is what you can do with 1 kB of program memory. Many Hackaday contests are rather loose with constraints — anyone can enter and at least make the judging rounds. This time 1 kB is a hard limit. If your program doesn’t fit, you’re disqualified, and that is a challenge worth stepping up to.

That said, this is Hackaday, we want people to be creative and work around the rules. The important thing to remember is the spirit of the design constraints: this is about doing all you can with 1 kB of program space. Search out the old and wise tricks, like compressing your code and including a decompression program in your 1 kB. Crafty hacks to squeeze more into less is fine. Using the 1 kB as a bootloader to load more code from an SD card is not fine.

Prizes

Any Hackaday contest needs some awesome prizes, and this one is no different.

Continue reading “Step Up to the 1 kB Challenge”

Enlightened Raspberry Pi Contest Winners

The Enlightened Raspberry Pi Contest wrapped up last week. As soon as the contest closed, Hackaday’s crack team of judges jumped on the case. Every entrant was carefully reviewed.  This was no easy feat! The field of 168 projects included both new concepts and old favorites. All of them were designed, built and documented with care. After all the votes were counted, 8 finalists rose to the top and were sent to [Matt Richadrson], [Ken Shirriff], and [Alvaro Prieto], our VIP judges, for the final ranking.

Each and every project creator deserves recognition for not only building an awesome project, but documenting it on Hackaday.io so others can build, modify, and enjoy their own versions. Without further ado, here are the winners of the Enlightened Raspberry Pi Contest!

Continue reading “Enlightened Raspberry Pi Contest Winners”

The Animated Gif Camera, Brought To You By A Raspberry Pi

No one watches video anymore. Cable cutters are digging into Verizon’s profits, and YouTube is a shadow of its 2005 self. What are people consuming now? Animated gifs. This is the bread and butter of the meme economy. Personally, all my investments are sunk deep into Gandolf / Balrog gifs, with each character replaced with Trump and Hillary. I expect a tidy profit on November 9th.

With animated gifs being the de facto method of sharing moving pictures, the world will belong to those who can create them. Phones are fine, but strangely video cameras, DSLRs, and other high-end photography equipment are the norm. This is idiotic, of course, because high-definition images are just a fad, and audio is useless.

Finally, there’s an answer. [Nick Brewer] created a camera that only takes animated gifs. I cannot stress this enough: this animated gif cam is a serious contender for a technical Oscar. Kubrick wept.

For the hardware, [Nick] went with a Raspberry Pi and Raspberry Pi camera. A combination of software ranging from PiCamera, GraphicsMagick, and GifCam turns this tiny bit of hardware into a machine dedicated to content creation in the hippest new medium. Other hardware includes a battery – either a normal LiPo ‘pouch’ cell, or an 18650 cell. Other hardware includes an Adafruit Powerboost 500 charge controller and a neat illuminated push button.

The 3D-printed enclosure is where this project really shines. Hearkening back to an older time, this camera includes a real viewfinder for all your gonzo giffing. The camera is charged through a completely normal USB port, and even the Pi’s SD card is accessible without disassembling the camera. There are even some paper wrappers for this camera to give it a 90s disposable camera aesthetic.

Of course, this isn’t the first camera dedicated to the creation of animated gifs. Before the C.H.I.P., Next Thing Co released OTTO, a camera designed for gifs. [Nick]’s project, though, is a camera dedicated completely to gifs. It is the greatest technical achievement of our time, for the creation of content in the greatest artistic medium.

Amalgamate is the Internet of Compost

A lot of people are scared of composting. After all, if the temperatures or humidity go badly wrong, you can end up with dried-out trash or a stinking soup. Getting the balance right is a secret known to the ancients: toss it in a big pile in your backyard. But what if you don’t have a big backyard?

Amalgamate is a composting setup for the urban dweller, or for people who just don’t like bugs. [Jamie] built it as her first Raspberry Pi project, and that makes it a great entrée into the world of things. But it’s no lightweight: the software measures temperature and humidity, and lets you schedule watering and rotating the compost. And of course, if you’re a micromanager, you can get up-to-the-minute vitals on your cellphone and tweak everything to run just perfectly. Continue reading “Amalgamate is the Internet of Compost”

Basement 3D Printer Builds Are Too Easy. Try Building One on Mars.

[Tony Stark Elon Musk] envisions us sending one million people to Mars in your lifetime. Put aside the huge number or challenges in that goal — we’re going to need a lot of places to live. That’s a much harder problem than colonization where mature trees were already standing, begging to become planks in your one-room hut. Nope, we need to build with what’s already up there, and preferably in a way that prepares structures before their inhabitants arrive. NASA is on it, and by on it, we mean they need you to figure it out as part of their 3D Printed Hab Challenge.

The challenge started with a concept phase last year, awarding $25k to the winning team for a plan to use Martian ice as a building material for igloo-like habs that also filter out radiation. The top 30 entries were pretty interesting so check them out. But now we’re getting down to the nitty-gritty. How would any of these ideas actually be implemented? If you can figure that out, you can score $2M.

Official rules won’t be out until Friday, but we’d love to hear some outrageous theories on how to do this in the comments below. The whole thing reminds us of one of the [Brian Herbert]/[Kevin J. Anderson] Dune prequels where swarms of robot colonists crash-land on planets throughout the universe and immediately start pooping out building materials. Is a robot vanguard the true key to planet colonization, and how soon do you think we can make that happen? We’re still waiting for robot swarms to clean up our oceans. But hey, surely we can do both concurrently.