Hackaday Prize Entry: DIY ARM Scientific Calculator

What does a hacker do when he or she wants something but can’t afford it? They hack one together, of course. Or, in the case of [Ramón Calvo], they thoughtfully plan and prototype. [Ramón Calvo] wanted a scientific calculator, but couldn’t afford one, so he designed and built one himself.

[Ramón] started off with Arduino but upgraded initially to Freescale’s Freedom KL25Z development board upgraded to an ARM Cortex-M0+ programmed using mbed. The display is an Electronic Assembly DOGL-128 128×64 pixel LCD. [Ramón] did a couple of iterations on the PCB, going from a large DIY one in order for the Arduino version to work, to the current, smaller version for the ARM chip with hand soldered SMD components. After that, [Ramón] looked into the algorithms needed to parse mathematical input. He settled on the shunting-yard algorithm, which converts the input into Reverse Polish Notation (RPN), which is easier for the software to work with.

[Ramón] has a ton of features working, including your standard add, subtract, multiply and divide operations, square root, nth root and exponentiation, trigonometry, log and log10, and factorial(!) There are a few things still on the to-do list, such as low power and a graphing mode, and there are a couple of bugs still in the system, but the overall system is up and running. [Ramón] has put up the schematic and KiCAD files up on his Hackaday.io project page along with the bill of materials.

We’ve had a few Hackaday prize entries in the form of calculators, such as this one with Nixie tubes and this one that emulates 70’s HP calculators.

Encoders Spin Us Right Round

Rotary encoders are great devices. Monitoring just a few pins you can easily and quickly read in rotation and direction of a user input (as well as many other applications). But as with anything, there are caveats. I recently had the chance to dive into some of the benefits and drawbacks of rotary encoders and how to work with them.

I often work with students on different levels of electronic projects. One student project needed a rotary encoder. These come in mechanical and optical variants. In a way, they are very simple devices. In another way, they have some complex nuances. The target board was an ST Nucleo. This particular board has a small ARM processor and can use mbed environment for development and programming. The board itself can take Arduino daughter boards and have additional pins for ST morpho boards (whatever those are).

The mbed system is the ARM’s answer to Arduino. A web-based IDE lets you write C++ code with tons of support libraries. The board looks like a USB drive, so you download the program to this ersatz drive, and the board is programmed. I posted an intro to mbed awhile back with a similar board, so if you want a refresher on that, you might like to read that first.

Reading the Encoder

The encoder we had was on a little PCB that you get when you buy one of those Chinese Arduino 37 sensor kits. (By the way, if you are looking for documentation on those kinds of boards, look here.; in particular, this was a KY-040 module.) The board has power and ground pins, along with three pins. One of the pins is a switch closure to ground when you depress the shaft of the encoder. The other two encode the direction and speed of the shaft rotation. There are three pull-up resistors, one for each output.

I expected to explain how the device worked, and then assist in writing some code with a good example of having to debounce, use pin change interrupts, and obviously throw in some other arcane lore. Turns out that was wholly unnecessary. Well… sort of.

Continue reading “Encoders Spin Us Right Round”

Hackaday Prize Entry: Explore M3 ARM Cortex M3 Development Board

Even a cursory glance through a site such as this one will show you how many microcontroller boards there are on the market these days. It seems that every possible market segment has been covered, and then some, so why on earth would anyone want to bring another product into this crowded environment?

This is a question you might wish to ask of the team behind Explore M3, a new ARM Cortex M3 development board. It’s based around an LPC1768 ARM Cortex M3 with 64k of RAM and 512k of Flash running at 100MHz, and with the usual huge array of GPIOs and built-in peripherals.

The board’s designers originally aimed for it to be able to be used either as a bare-metal ARM or with the Arduino and Mbed tools. In the event the response to their enquiries with Mbed led them to abandon that support. They point to their comprehensive set of tutorials as what sets their board apart from its competition, and in turn they deny trying to produce merely another Arduino or Mbed. Their chosen physical format is a compact dual-in-line board for easy breadboarding, not unlike the Arduino Micro or the Teensy.

If you read the logs for the project, you’ll find a couple of videos explaining the project and taking you through a tutorial. They are however a little long to embed in a Hackaday piece, so we’ll leave you to head on over if you are interested.

We’ve covered a lot of microcontroller dev boards here in our time. If you want to see how far we’ve come over the years, take a look at our round up, and its second part, from back in 2011.

ARMing a Breadboard — Everyone Should Program an ARM

I’m always a little surprised that we don’t see more ARM-based projects. Of course, we do see some, but the volume isn’t what I’d expect given that low-level ARM chips are cheap, capable, low power, and readily available. Having a 32-bit processor with lots of memory running at 40 or 50 MIPS is a game changer compared to, say, a traditional Arduino (and, yes, the Arduino Due and Zero are ARM-based, so you can still stay with Arduino, if that’s what you want).

A few things might inhibit an Arduino, AVR, or PIC user from making the leap. For one thing, most ARM chips use 3.3V I/O instead of the traditional 5V levels (there are exceptions, like the Kinetis E). There was a time when the toolchain was difficult to set up, although this is largely not a problem anymore. But perhaps the largest hurdle is that most of the chips are surface mount devices.

Of course, builders today are getting pretty used to surface mount devices and you can also get evaluation boards pretty cheaply, too. But in some situations–for example, in classrooms–it is very attractive to have a chip that is directly mountable on a common breadboard. Even if you don’t mind using a development board, you may want to use the IC directly in a final version of a project and some people still prefer working with through hole components.

The 28 Pin Solution

One solution that addresses most, if not all, of these concerns is the LPC1114FN28 processor. Unlike most other ARM processors, this one comes in a 28 pin DIP package and works great on a breadboard. It does require 3.3V, but it is 5V tolerant on digital inputs (and, of course, a 3.3V output is usually fine for driving a 5V input). The chip will work with mbed or other ARM tools and after prototyping, you can always move to a surface mount device for production, if you like. Even if you are buying just one, you should be able to find the device for under $6.

Continue reading “ARMing a Breadboard — Everyone Should Program an ARM”

How To Build a Pocket-Sized mBed Signal Generator

Last month, I talked about how to get started with mBed and ARM processors using a very inexpensive development board. I wanted to revisit mBed, though, and show something with a little more substance. In particular, I often have a need for a simple and portable waveform generator. It doesn’t have to be too fancy or meet the same specs as some of the lab gear I have, but it should be easy to carry, power off USB, and work by itself when required.

My requirements mean I needed a slightly more capable board. In particular, I picked up a K64F board. This is very similar to the KL25Z board but has a bit more of everything–speed, memory, etc. What I really wanted, though, was the SD card slot. I did, however, do my early testing on a KL25Z, so if you have one, you can still work through the code, although standalone operation won’t be possible. The price jumps from $13 to $35, but you get a lot more capability for the price.

Continue reading “How To Build a Pocket-Sized mBed Signal Generator”

ZX81 Emulated on an mbed

This is a wonderful example of the phenomenon of “feature creep”. [Gert] was working on getting a VGA output running on an mbed platform without using (hardly) any discrete components. Using only a few resistors, the mbed was connected to a VGA display running at 640×480. But what could he do with something with VGA out? He decided to emulate an entire Sinclair ZX81 computer, of course.

With more than 1.5 million units sold, the Sinclair ZX81 was a fairly popular computer in the early ’80s. It was [Gert]’s first computer, so it was a natural choice for him to try to emulate. Another reason for the choice was that his mbed-VGA device could only output monochrome color, which was another characteristic of the ZX81.

[Gert] started by modifying a very lean Z80 emulator to make the compiled code run as efficiently as possible on the mbed. Then he went about getting a picture to display on the screen, then he interfaced an SD card and a keyboard to his new machine. To be true to the original, he built everything into an original ZX81 case.

This isn’t the first time we’ve seen a ZX81, but it is one of the better implementations of an emulated version of this system we’ve seen.

Thanks to [Jeroen] for the tip!

Controlling a railroad with an mbed


The word hacking got its start with model railway clubs, and the state of the art belies the current advancements in computer control and very, very small microcontrollers. [Jim] put together a great tutorial for driving model locomotives with a microcontroller, in this case an ARM-powered mbed.

Low-end model locomotives are controlled with DC, so an H-bridge and a PWM out on the mbed makes sense to drive these trains. [Jim] wired up a Pololu H-bridge driver, connected it to his mbed, and everything ran great.

Rail switches are another matter entirely. These allow trains to move from one track to another, but having them go to the left or right requires powering a fairly high current solenoid with 15 to 24 volts. For this, [Jim] used a MOSFET power control board to switch the rails and came up with a pretty neat demo that shows a small locomotive going back and forth over a single rail switch.

There is another class of model locomotive – ones with Digital Command Control. This setup is just a small decoder chip that fits inside an engine and tells the locomotive to turn on a lamp or run a motor digitally, allowing the conductor to control multiple trains on the same track.

[Jim] goes through the basics of DCC using the mbed, allowing two trains to switch positions in a rail yard using computer control. It’s really cool stuff that leaves us wanting a little more room in the basement to start building a huge computer controlled model railway.

Continue reading “Controlling a railroad with an mbed”