Tag Archives: Microcontrollers

Adding ADC to Microcontrollers without ADC

via Dangerous Prototypes


Scott Harden writes:

I recently had the need to carefully measure a voltage with a microcontroller which lacks an analog-to-digital converter (ADC), and I hacked together a quick and dirty method to do just this using a comparator, two transistors, and a few passives. The purpose of this project is to make a crystal oven controller at absolute minimal cost with minimal complexity. Absolute voltage accuracy is not of high concern (i.e., holding temperature to 50.00 C) but precision is the primary goal (i.e., hold it within 0.01 C of an arbitrary target I set somewhere around 50 C).

More details at Scott Harden’s blog.

VHF Frequency Counter with PC Interface

via Dangerous Prototypes


Scott has published a new build:

This is the general idea behind how this frequency counter works. It’s so simple! It’s entirely digital, and needs very few passive components. sn74lv8154 is configured in 32-bit mode (by chaining together its two 16-bit counters, see the datasheet for details) and acts as the front-end directly taking in the measured frequency. This chip is “rare” in the sense I find very few internet projects using it, and they’re not available on ebay. However they’re cheap and plentiful on mouser, so I highly encourage others to look into using it! The datasheet isn’t very clear about its maximum frequency, but in my own tests I was able to measure in excess of 100 MHz from a breadboarded circuit! This utilized two cascaded ICS501 PLL frequency multiplier ICs to multiply a signal I had available (the 11.0592 MHz crystal the MCU was running from) by ten, yielding 110 MHz, which it was able to measure

Project info at SWHarden homepage.

Pressure, temperature and humidity sensor based on MS5637 HDC1080

via Dangerous Prototypes


Mare writes:

This is another small module to measure air pressure, temperature and humidity. Two sensors are on-board: MS5637 and HDC1080. Microcontroller is small cortex M0 in TSSOP-20 housing from STM: STM32F070CxP. The SN65HVD72DGKR provides RS485 interface functionality with half duplex mode. Voltage regulator, reverse polarity protection and some LED indicators are provided on-board. Complete module is 10x55mm, produced on single-sided PCB, easily producible in every home lab with proto-PCB capability.

More info at Mare & Gal Electronics homepage.

Hands-On With The BBC Micro:Bit

via hardware – Hackaday

It’s been a long wait, but our latest single board computer for review is finally here! The BBC micro:bit, given free to every seventh-grade British child, has landed at Hackaday courtesy of a friend in the world of education. It’s been a year of false starts and delays for the project, but schools started receiving shipments just before the Easter holidays, pupils should begin lessons with them any time now, and you might even be able to buy one for yourself by the time this article goes to press.

The micro:bit top view
The micro:bit top view

It’s a rather odd proposition, to give an ARM based single board computer to coder-newbie children in the hope that they might learn something about how computers work, after all if you are used to other similar boards you might expect the learning curve involved to be rather steep. But the aim has been to position it as more of a toy than the kind of development board we might be used to, so it bears some investigation to see how much of a success that has been.

Opening the package, the micro:bit kit is rather minimalist. The board itself, a short USB lead, a battery box and a pair of AAA cells, an instruction leaflet, and the board itself.  Everything is child-sized, the micro:bit is a curved-corner PCB about 50mm by 40mm. The top of the board has a 5 by 5 square LED matrix and a pair of tactile switches, while the bottom has the surface-mount processor and other components, the micro-USB and power connectors, and a reset button. Along the bottom edge of the board is a multi-way card-edge connector for the I/O lines with an ENIG finish. On the card edge connector several contacts are brought out to wide pads for crocodile clips with through-plated holes to take 4mm banana plugs, these are the ground and 3V power lines, and 3 of the I/O lines.

The micro:bit bottom view
The micro:bit bottom view

It is obvious when compared to other single board computers that this one has been designed with the pocket of a 12-year-old in mind. It’s a robust 1.6mm thick board that is devoid of  pins and spiky connectors, and on which care has obviously been taken to ensure as low a profile as possible.

In hardware terms it has an ARM Cortex M0 processor from Nordic Semiconductor, a compass, accelerometer, Bluetooth Low Energy and USB as well as the previously mentioned switches, LEDs, and GPIOs.

To use the device, you have the choice of connecting it to your computer via USB, or to your phone or tablet via Bluetooth Low Energy. Sadly none of our devices support BLE so for this review we’ll be taking the former approach.

All programming is performed through a selection of web-based environments, with code editing and compilation performed online and the resulting binary file arriving as a download before being placed on the micro:bit by the user through the filesystem. Since the micro:bit is also an mbed under the hood we’d expect it to be programmable using the mbed toolchain, however that is beyond the scope of this review.

The development environments are all accessible through the micro:bit website, on which no login is required for writing code. On clicking the “Create code” button you are presented with a choice of four, Code Kingdoms JavaScript, Microsoft Block Editor, Microsoft Touch Develop, and Python. The micro:bit leaflet says you need a PC running Windows 7 or later or a Mac running OS X 10.6 or later, however we encountered no problems using Chromium on a Linux desktop. Each of the different environments has its own flavour and audience, so it’s worth considering them all in turn.

The Code Kingdoms Javascript editor
The Code Kingdoms Javascript editor

First up is Code Kingdoms Javascript. This is not what you might expect as a Javascript editor, instead it’s a drag-and drop visual coding environment which creates Javascript blocks. On the left are a series of menus containing the available code blocks, in the middle the coding area, on the right a software micro:bit emulator. At the bottom on the left are buttons to run your code in the emulator, save it with your other scripts, or compile and download it to be placed on the micro:bit.

In use, the Code Kingdoms editor is straightforward and intuitive, the code for a simple compass you can see in our screenshot was very quick to assemble as a first effort. Unfortunately though in our browser at least it was extremely slow, at times almost to the point of being unusable. In particular when you wish to remove a code block it starts up an animation of its waste bin opening up which slows the browser to a crawl. It is not a good sign when you load a web page and hear your processor fan spin up.

The Microsoft Block editor
The Microsoft Block editor

Following the Code Kingdoms editor is Microsoft’s Block Editor. This is a drag-and drop visual editor in the same vein as the Code Kingdoms editor, except that there is no pretence of building a more traditional coding language and it is a much faster and smoother experience. The interface is broadly similar in layout to the Code Kingdoms editor, except for the compile and run commands which are at the top, above the coding window.

In our screenshot you’ll see a very simple environmental monitor designed to display readings from the micro:bit’s various sensors. Yet again this was a simple and intuitive piece of software to assemble for someone using the environment for the first time.

Microsoft's Touch Develop editor
Microsoft’s Touch Develop editor

The third environment is another one from Microsoft, their Touch Develop editor. This is different from the other editors in that it is designed especially for use in touch environments on tablets and phones, so we tested it on an Android phone.

While the Touch Develop editor follows the same idea as the previous two of building code by selecting blocks from menus, it creates something a lot closer to text code, and requires the user to manually enter for example function parameters. We found its help system to be a little difficult on this front, it’s doubtless a useful editor if you know its intricacies but there is quite a learning curve for a first-time user.

The Touch Develop team have made as good a good job of putting a development environment onto a phone screen as they could and it is very usable, however due to the limited screen space it is still a little awkward and crowded. With luck this should be less of an issue for tablet owners.

It is worth pointing out that this editor can be stored as an offline bookmark allowing it to be used without an Internet connection, however it is not clear how any code written in this way might be compiled.

The micro:bit Python editor
The micro:bit Python editor

The final editor choice for the micro:bit is Python, in fact a micro:bit build of MicroPython. This editor lacks the software micro:bit emulator, but is much more like the kind of software environment that Hackaday readers will be used to. The main window is a straight text editor ready to type your Python into, and there is no menu of predefined code blocks. Instead there is a comprehensive introduction, tutorial, and documentation of the various micro:bit Python libraries, and once you are armed with those you can step right in and start writing code.

In use if you are happy with Python it is very straightforward. If your code generates any errors they are displayed scrolling across the micro:bit’s LED matrix which can be rather tedious, however at least the errors we generated were informative and led us straight to the points in our compass code which had gone wrong.

Looking at the libraries available in this editor it becomes clear that Python is the most powerful way to control your micro:bit. As well as the simple functions available in the other editors it offers libraries for I2C, SPI, UART, Neopixels and more. It’s immediately obvious that this is where the micro:bit’s “Wow!” hacks are most likely to be created.

The micro:bit with its battery pack
The micro:bit with its battery pack

Having looked at all the editors, our choices would be Python as the most powerful coding environment for experienced coders, and the Microsoft Block editor as the most useful drag-and-drop environment for beginners. The Code Kingdoms editor is nice but glacially slow, and the Touch Develop editor is a bit fiddly. It’s worth mentioning that all the editors have an option to save code locally, this produces an LZMA-compressed file with raw code in a JSON structure.

Of course, though some of us may benefit from it, this board is not made for Hackaday readers but for children. If it gets the recipe right, in a decade’s time it will be cited by a generation of new graduates as the machine that got them into software, but has it hit the mark? Since the children in question are only now receiving their first lessons it’s a bit early to tell, but the teacher lent us this micro:bit for the review tells us there are only two minor gripes. Not having an on-off switch they go through batteries at a phenomenal rate, and since their failed programs show no LEDs they think they’ve killed it when their software doesn’t work. The first it’s possible the kids will fix themselves by learning to unplug the packs, and perhaps the micro:bit people can fix the second with a software update. If these are the worst things that can be said about it though there can’t be too much wrong with it.

Filed under: computer hacks, Featured, hardware, Interest, Microcontrollers, slider

Megaprocessor is a Macro Microprocessor

via hardware – Hackaday

If we have to make a list of Projects that are insane and awesome at the same time, this would probably be among the top three right up there. For the past few years, [James Newman] has been busy building Megaprocessor – a huge micro-processor made out of transistors and LED’s, thousands of ’em. “I started by wanting to learn about transistors. Things got out of hand.” And quite appropriately, he’s based out of Cambridge – the “City of perspiring dreams“. The Why part is pretty simple – because he can. We posted about his build as recently as 10 months back, but he’s made a ton of progress since then and an update seemed in order.

megaprocessor_04How big is it ? For starters, the 8-bit adder module is about 300mm (a foot) long – and he’s using five of them. When fully complete, it will stretch 14m wide and stand 2m tall, filling a 30 sq.m room, consisting of seven individual frames that form the parts of the Megaprocessor.

The original plan was for nine frames but he’s managed to squeeze all parts in to seven, building three last year and adding the other four since then. Assembling the individual boards (gates), putting them together to form modules, then fitting it all on to the frames and putting in almost 10kms of cabling is a slow, painstaking job, but he’s been on fire last few months. He has managed to test and integrate the racks shown here and even run some code.

The Megaprocessor has a 16-bit architecture, seven registers, 256bytes of RAM and a questionable amount of PROM (depending on his soldering endurance, he says). It sips 500W, most of it going to light up all the LED’s. He guesses it weighs about half a ton. The processor uses up 15,300 transistors and 8,500 LED’s, while the RAM has 27,000 transistors and 2,048 LED’s. That puts it somewhere between the 8086 and the 68000 microprocessors in terms of number of transistors. He recently got around to calculating the money he’s spent on this to date, and it is notching up over 40,000 Quid (almost $60,000 USD)!  You can read a lot of other interesting statistics on the Cost and Materials page.

And kudos to his crazy Ninja skills to notch up just a few failed, bad solder joints, out of a total of over 250,000, and one dead transistor from among almost 42,000. A few cable crimping issues were the least of his troubles. The worst part was when he received a wrong batch of 4000 transistors (correct purchase order, correct packing list, but wrong parts bagged). He realized the problem after soldering all of them, setting him back by quite a bit. He didn’t bother de-soldering them but instead just built fresh replacement boards. He also built a hardware/software simulator for the Megaprocessor using an FPGA board to help him validate his design. Among the first programs he created were a few games (obviously) – Tetris, Tic-Tac-Toe, Life – for which he needed a suitable input device. So he modded a Venom Arcade stick which usually expects itself to be connected to a PlayStation via USB. He says it was “a very civilized thing to mod”.

There is a LOT more interesting stuff to read on his detailed blog posts, so go grab a supply of Coffee, switch off your Phone, and settle in for a few hours diving in to his crazy-awesome build. “This is nuts” said [Clovis Fritzen], who sent in this tip via the BBC News website. Thanks, and we’d agree with his assessment. Check out a couple of videos of the Megaprocessor in action below.


Filed under: hardware, Microcontrollers

Programmable CW Morse Keyer / beacon

via Dangerous Prototypes


Marko Pavlin has designed a Mini USB dongle with STM32F0xx , he writes:

Mini USB dongle with STM32F0xx is suitable many for simple, mini projects. I attached speaker to Timer14 PWM output (Pin PA6) and LED (or optocoupler connected to PTT) to GPIO pin PA0
The provided software is based on USB Virtual Com Port (VCP) device. The setup is done with command line interface using terminal from any PC. The setup is stored in the internal flash and PC is not required for normal operation. The mini beacon keyer can be used when powered with 5V.

Project info at Mare & Gal Electronics.