All You’ve Ever Wanted To Know About Compilers

They say that in order to understand recursion, you must first understand recursion. Once you master that concept, you might decide that it’s time to write your own compiler that can compile itself as a fun side project. According to [Warren] aka [DoctorWkt], who documented every step of writing this C compiler from scratch, a true compiler will be able to do that.

Some of the goals for the project included self-compiling, focusing on a real hardware platform, practicality, and simplicity. [Warren] outlines a lot of the theory of compilers as well, including all the lexical, grammar, and semantic analysis and then the final translation into assembly language, but really focuses on making this compiler one for practical use rather than just a theoretical implementation. He focuses on Intel x86-64 and 32-bit ARM platforms too, which are widely available.

This project is a long read and very thoroughly documented at around 100,000 words, so if you’ve ever been interested in compilers this is a great place to start. There are a lot of other great compiler tools floating around too, like the Compiler Explorer which shows you generated code as you write in a higher level language.

[via Hackaday.io]

Arduino Wristwatch Has LED Hands

When you read “Arduino wristwatch”, you fall into the trap of envisioning an Arduino UNO clumsily strapped to someone’s wrist. [Marijo Blažević’s] creation is much more polished than that. A round circuit board holds two surface mount ICs and 12 LEDs. The whole thing looks nice fit snugly inside of a watch body. It isn’t a Rolex, but it does have considerable geek cred without being unwearable in polite company.

One IC is an AVR micro, of course. The other is a DS3231 real time clock with built-in crystal. A CR2032 keeps it all running. The main body, the outer ring, the bottom, and the buttons are 3D printed in PLA. The crystal and the band are the only mechanical parts not printed. The bill of materials shows a 36mm crystal and even provides links for all the parts.

You don’t want to run LEDs all the time because it is bad on the battery. When you press the button once, you get one of the LEDs to light to show the hours. Another press reads the minutes in units of 5 minutes. A third press shows you one of five LEDs to show how many minutes to add. For example, if the time is 9:26 you’d get LED 9 (hours), LED 5 for 25 minutes, and the third press would show LED 1 for 1 extra minute. If either of the minute indicators show 12 o’clock, that indicates zero minutes.

The exciting thing, of course, is that you can program it beyond the code on GitHub. Already it can tell time and display the temperature. You don’t have a lot of I/O, but you ought to be able to get some more options and maybe some flashy LED blinking patterns in if you try.

2D-Platform Seeks Balance With A Touch Screen

It’s the [Bruce Land]-iest season of all, when the Cornell professor submits the projects his microcontroller class students have been working on all semester. Imagination does not seem to be in short supply with these students, and we always look forward to these tips this time of year.

[Greg] and [Sam]’s touch-screen two-dimensional ball balancer is a good example of what [Land]’s students turn out. The resistive touch screen is supported by a 3D-printed gimballed platform and tilted in two axes by hobby servos. [Greg] and [Sam] chose to read the voltage outputs from the touch screen directly using the ADC on a PIC32, toggling between the two axes at 2 kHz. Two PID control loops were implemented to keep the ball as centered as possible on the platform, and the video below shows that there’s still some loop tuning to do. But given the positional inaccuracies of hobby servos and the compliance in the gimbal, we’re impressed that they were able to keep the system under control at all.

Of course we’ve seen ball-balancers before, but most of them have closed the loop using either cameras or microphones. Seeing direct sensing on the platform like this is a nice change of pace. Continue reading “2D-Platform Seeks Balance With A Touch Screen”

3D-Printed Moiré Illusion May Just Drive You Crazy

Moiré illusions can be visually captivating, particularly when a little rotational motion is thrown in the mix. [Dushyant Ahuja] was a fan of these moving Moiré sculptures he’d seen around the place, and decided to create his own.

The build is based around spinning two spoked discs in opposite directions, such that the spokes create moving Moiré patterns as they turn. To achieve this, the discs were 3D printed, along with a central housing containing two 12 volt gear motors. 3D printed gears are used to allow both discs to rotate about the same axis. Nominally, the motors spin relatively slowly, generating a pleasing, hypnotic effect when turning the discs.

The drivetrain is under the control of an ESP8266, though [Dushyant] notes that to get the basic effect, one need only connect the motors to a 12 volt power supply and let them run. However, future plans involve adding some LEDs for bling, and varying the motor speed to create yet more complex effects. With the microcontroller already installed, upgrades should be a cinch.

Moiré effects are good for everything from guiding ships to taking precision measurements. If you’ve found a new application for these confounding line patterns, be sure to let us know! Video after the break.

Continue reading “3D-Printed Moiré Illusion May Just Drive You Crazy”

Baby’s First Jukebox Is Fun For Parents, Too

Believe it or not, there’s a $400 toy mp3 player out there for kids. It looks pretty nice, with colorful buttons and a wood console and all, but those features don’t really justify the price tag. [DerThes] wanted one for his 2-year-old anyway, so he made his own ruggedized version for a whole lot less.

The simple and kid-friendly interface lets [DerThes Jr.] choose from one of nine albums to play by pushing one of the candy-colored buttons. The bottom row of buttons handle play/pause and moving through the track list. When mom and dad get tired of listening to whatever the kids are into these days, they can enter the special god mode code to access 99 of their favorite albums.

This baby boombox is built with an Arduino Uno and an Adafruit music maker shield. [DerThes] etched his own PCB to hold the buttons and the pair of shift registers needed to interface them with the Uno. If you’ve never etched before, here’s a good chance to dip your toe in the ferric chloride, because [DerThes] has the transparency in his repo and a line on a nice instructional video.

If you don’t think your toddler is ready to respect a field of momentaries, you could make a jukebox with NFC blocks.

[via Arduino blog]

Datacenter UPS Heads Home For Off-Grid Power Solution

The news sites seem never to be without stories of Elon Musk and his latest ventures, be they rapid transit tube tubes in partial vacuum, space flight, or even personal not-a-flamethrowers. Famous for electric vehicles, Musks’s Tesla also has a line of solar products and offers the Powerwall home battery power system. These are tantalizing to anyone with solar panels, but the price tag for one isn’t exactly a dream.

[Nathann]’s budget couldn’t stretch to a Powerwall, but he did have access to a hefty ex-datacentre uninterruptible power supply (UPS) and a large quantity of lead-acid cells. From this he built his own off-the-grid power in the cellar of the home. It’s not as elegant as a Powerwall, but it can power the house on moderate usage, so he claims, for up to ten days.

On one level the installation is more of a wiring job than one of high technology, but the logistics of dealing with nearly 100 lead-acid cells are quite taxing. The UPS takes four battery packs, each clocking in at 288 V. The cells are joined with copper straps, and the voltage and current involved is not for the faint-hearted. An accidental short vaporized a screw and a battery terminal; if this were our house we’d put fuses in the middle of the battery packs.

The batteries are stored on wooden pallets atop brick pillars in case the cellar floods. The basement installation now is ready for the addition of solar and wind-based off-grid sources. Maybe your battery power solution will be less hair-raising, but it’s unlikely to be cheaper. Meanwhile this isn’t the first such project we’ve seen, though others usually go for 18650 Li-Ion cells, the use of lead acid remains a viable and economical solution.

Altair 8800 Again Project

[Dirk] posted a video (you can see below) titled, “Mystery Retro Project Start.” That turned out to be the first of a multipart series on his Altair 8800 Again simulator. The front panel appears to be laser cut and in some future video episodes, we expect to see him simulate the CPU with a Teensy.

There have been plenty of 8800 clones ranging from projects that recreate the original PCBs, to those that just run a Raspberry Pi inside. The middle ground will use an Arduino or some other small CPU to simulate the 8080 CPU.

Continue reading “Altair 8800 Again Project”