In the last episode, I advocated a little bit for Forth on microcontrollers being a still-viable development platform, not just for industry where it’s usually seen these days, but also for hackers. I maybe even tricked you into buying a couple pieces of cheap hardware. This time around, we’re going to get the Forth system set up on that hardware, and run the compulsory “hello world” and LED blinky. But then we’ll also take a dip into one of the features that make Forth very neat on microcontrollers: easy multitasking.
Mecrisp-Stellaris Forth runs on a great number of ARM microcontrollers, but I’ll focus here on the STM32F103 chips that are available for incredibly little money in the form of a generic copy of the Maple Mini, often called a “STM32F103 Minimum System Board” or “Blue Pill” because of the form-factor, and the fact that there used to be red ones for sale. The microcontroller on board can run at 72 MHz, has 20 kB of RAM and either 64 or 128 kB of flash. It has plenty of pins, the digital-only ones are 5 V tolerant, and it has all the usual microcontroller peripherals. It’s not the most power-efficient, and it doesn’t have a floating-point unit or a DAC, but it’s a rugged old design that’s available for much less money than it should be.
Similar wonders of mass production work for the programmer that you’ll need to initially flash the chip. Any of the clones of the ST-Link v2 will work just fine. (Ironically enough, the hardware inside the programmer is almost identical to the target.) Finally, since Forth runs as in interactive shell, you’re going to need a serial connection to the STM32 board. That probably means a USB/serial adapter.
This whole setup isn’t going to cost much more than a fast food meal, and the programmer and USB/serial adapter are things that you’ll want to have in your kit anyway, if you don’t already.
You can power the board directly through the various 3.3 and GND pins scattered around the board, or through the micro USB port or the 5V pins on the target board. The latter two options pass through a 3.3 V regulator before joining up with the 3.3 pins. All of the pins are interconnected, so it’s best if you only use one power supply at a time.
The RISC-V ISA has seen an uptick in popularity as of late — almost as if there’s a conference going on right now — thanks to the fact that this instruction set is big-O Open. This openness allows anyone to build their own software and hardware. Of course, getting your hands on a RISC-V chip has until now, been a bit difficult. You could always go over to opencores, grab some VHDL, and run a RISC-V chip on an FPGA. Last week, OnChip released the RISC-V Open-V in real, tangible silicon.
Choice is always a good thing, and now SiFive, a fabless semiconductor company, has released the HiFive1 as a crowdfunding campaign on CrowdSupply. It’s a RISC-V microcontroller, completely open source, and packaged in the ever so convenient Arduino form factor.
The heart of the HiFive1 is SiFive’s FE310 SoC, a 32-bit RISC-V core running at 320+ MHz. As far as peripherals go, the HiFive1 features 19 digital IO pins, one SPI controller, 9 PWM pins, an external 128Megabit Flash, and five volt IO. Performance-wise, the HiFive1 is significantly faster than the Intel Curie-powered Arduino 101, or the ARM Cortex M0+ powered Arduino Zero. According to the crowdfunding campaign, support for the Arduino IDE is included. A single HiFive1 is available for $59 USD.
Since this is an Open Source chip, you would expect everything about it to be available. SiFive has everything from the SDK to the RTL available on GitHub. This is an impressive development in the ecosystem of Open Hardware, and something we’re going to take a look at when these chips make it out into the world.
[Scott Harden] is working on a research project involving optogenetics. From what we were able to piece together optogenetics is like this: someone genetically modifies a mouse to have cell behaviors which can activated by light sensitive proteins. The mice then have a frikin’ lasers mounted on their heads, but pointing inwards towards their brains not out towards Mr. Bond’s.
Naturally, to make any guesses about the resulting output behavior from the mouse the input light has to be very controlled and exact. [Scott] had a laser and he had a driver, but he didn’t have a controller to fire the pulses. To make things more difficult, the research was already underway and the controller had to be built
The expensive laser driver had a bizarre output of maybe positive 28 volts or, perhaps, negative 28 volts… at eight amps. It was an industry standard in a very small industry. He didn’t have a really good way to measure or verify this without either destroying his measuring equipment or the laser driver. So he decided to just build a voltage-agnostic input on his controller. As a bonus the opto-isolated input would protect the expensive controller.
The output is handled by an ATtiny85. He admits that a 555 circuit could generate the signal he needed, but to get a precision pulse it was easier to just hook up a microcontroller to a crystal and know that it’s 100% correct. Otherwise he’d have to spend all day with an oscilloscope fiddling with potentiometers. Only a few Hackaday readers relish the thought as a relaxing Sunday afternoon.
He packaged everything in a nice project box. He keeps them on hand to prevent him from building circuits on whatever he can find. Adding some tricks from the ham-radio hobby made the box look very professional. He was pleased and surprised to find that the box worked on his first try.
Whenever we write up a feature on a microcontroller or microcontroller project here on Hackaday, we inevitably get two diametrically opposed opinions in the comments. If the article featured an 8-bit microcontroller, an army of ARMies post that they would do it better, faster, stronger, and using less power on a 32-bit platform. They’re usually right. On the other hand, if the article involved a 32-bit processor or a single-board computer, the 8-bitters come out of the woodwork telling you that they could get the job done with an overclocked ATtiny85 running cycle-counted assembly. And some of you probably can. (We love you all!)
When beginners walk into this briar-patch by asking where to get started, it can be a little bewildering. The Arduino recommendation is pretty easy to make, because there’s a tremendous amount of newbie-friendly material available. And Arduino doesn’t necessarily mean AVR, but when it does, that’s not a bad choice due to the relatively flexible current sourcing and sinking of the part. You’re not going to lose your job by recommending Arduino, and it’s pretty hard to get the smoke out of one.
But these days when someone new to microcontrollers asks what path they should take, I’ve started to answer back with a question: how interested are you in learning about microcontrollers themselves versus learning about making projects that happen to use them? It’s like “blue pill or red pill”: the answer to this question sets a path, and I wouldn’t recommend the same thing to people who answered differently.
For people who just want to get stuff done, a library of easy-to-use firmware and a bunch of examples to crib learn from are paramount. My guess is that people who answer “get stuff done” are the 90%. And for these folks, I wouldn’t hesitate at all to recommend an Arduino variant — because the community support is excellent, and someone has written an add-on library for nearly every gizmo you’d want to attach. This is well-trodden ground, and it’s very often plug-and-play.
The 2nd annual Omaha Mini Maker Faire wasn’t our first rodeo, but it was nonetheless a bit surprising . Before we even made it inside to pay our admission to the Omaha Children’s Museum, I took the opportunity to pet a Transylvanian Naked Neck chicken at one of the outdoor booths. The amiable fowl lives at City Sprouts, an Omaha community farming collective in its 20th year of operation. There seemed to be a theme of bootstrappy sustainability among the makers this year, and that’s great to see.
Just a few feet away sat a mustard-colored 1975 Chevy pickup with a food garden growing in its bed. This is Omaha’s truck farm, an initiative that seeks to educate the city’s kids in the ways of eating locally and growing food at home. On a carnivorous note, [Chad] from Cure Cooking showed my companion and me the correct way to dry-cure meats using time-honored methods.
The previous go-to part from the ST catalog was the STM32F4, an extremely powerful chip based on the ARM Cortex M4 processor. This chip was incredibly powerful in its time, and is still a respectable choice for any application that needs a lot of horsepower, but not a complete Linux system. We’ve seen the ~F4 chip pump out 800×600 VGA, drive a thermal imaging camera, and put OpenCV inside a webcam. Now there’s a new, even more powerful part on the market, and the mind reels thinking what might be possible.
Right now there a few STM32F7 parts out, both with speeds up to 216MHz, Flash between 512k and 1MB, and 320kB of RAM. Peripherals include Ethernet, USB OTG, SPDIF support, and I²S. The most advanced chip in the line includes a TFT LCD controller, and a crypto processor on-chip. All of the chips in the STM32F7 line are pin compatible with the STM32F4 line, with BGA and QFP packages available.
As with the introduction of all of ST’s microcontrollers, they’re rolling out a new Discovery board with this launch. It features Ethernet, a bunch of audio peripherals, USB OTG, apparently an Arduino-style pin layout, and a 4.3 inch, 480×272 pixel LCD with capacitive touch. When this is available through the normal distributors, it will sell for around $50. The chips themselves are already available from some of the usual distributors, for $17 to $20 in quantity one. That’s a chunk of change for a microcontroller, but the possibilities for what this can do are really only limited by an engineer’s imagination.
[Shane] recently built an automated plant watering system for his home. We’ve seen several similar projects before, but none of them worked quite like this one. Shane’s system is not hooked into the house plumbing and it doesn’t use any off-the-shelf electronic valves.
Instead, [Shane’s] build revolves around a device that looks like it was intended to spray weed killer. The unit works sort of like a Super Soaker. The user fills the jug with water and then pumps a handle multiple times to build up some pressure inside the jug. Then a button can be pressed and the air pressure forces water out of the nozzle. [Shane] came up with a way to automate all of these mechanical motions.
First [Shane] had to find a way to pump up the bottle. He purchased a car door electronic lock actuator from eBay. It’s a pretty simple device. It’s just a DC motor with a gear box that turns the rotational motion of the motor into linear motion. This is mounted to a wooden jig and attached to the pump. A dsPIC microcontroller rotates the motor back and forth, which in turn pumps up the bottle.
The dsPic is also hooked up to a small servo. The servo is mounted to the same wooden jig as the car door actuator. A small arm is mounted to the servo so that when it rotates, the arm presses the pressure release button. This sends the water out of the bottles nozzle. [Pat] hooked up a small length of hose to the nozzle so he can direct the water into his plants. The video below demonstrates how the unit works. Continue reading “Automated Plant Watering System Uses Car Parts”→