Raindrops on roses, and whiskers on kittens. They’re ok, but state machines are absolutely on our short list of favorite things.
There are probably as many ways to implement a state machine as there are programmers. These range from the terribly complex, one-size-fits-all frameworks down to simply writing a single
switch...case block. The frameworks end up being a little bit of a black box, especially if you’re just starting out, while the
switch...case versions are very easy to grok, but they don’t really help you write clear, structured code.
In this extra-long edition of Embed with Elliot, we’ll try to bridge the middle ground, demonstrating a couple of state machines with an emphasis on practical coding. We’ll work through a couple of examples of the different ways that they can be implemented in code. Along the way, we’ll Goldilocks solution for a particular application I had, controlling a popcorn popper that had been hacked into a coffee roaster. Hope you enjoy.
Continue reading “Embed with Elliot: Practical State Machines”
Putting an full microcontroller platform in a DIP format is nothing new – the Teensy does it, the Arduino nano does it, and a dozen other boards do it. [Alex] and [Alexey] aren’t content with just a simple microcontroller breakout board so they’re adding a radio, an OLED, an SD card reader, and even more RAM to the basic Arduino platform, all in a small, easy to use package.
The DIPDuino, as [Alex] and [Alexy] are calling it features an ATmega1284 processor. To this, they’re adding a 128×32 pixel OLED, a micro SD slot, and 1Mbit of SRAM. The microcontroller is a variant that includes a 2.4 GHz Zigbee radio that allows for wireless connections to other DIPDuinos.
What are [Alex] and [Alexey] going to do with their cool little board? They’re planning on using the OLED for a watch, improve their software so the firmware can be updated from the SD card, and one of [Alex]’s friends wants to build a RepRap controller with one of these. There’s a lot of potential with this board, and we’re interested in seeing where the guys take the project from here.
Sometimes the most mundane products have surprisingly sophisticated internals. What’s in a game controller? If it is a Wii remote, you’ll find a lot inside–an IR sensor, Bluetooth, an accelerometer, and EEPROM. It also has a six pin expansion port that allows I2C peripherals connect to the controller.
[DotMusclera] wanted to experiment with a gyroscope and decided to hook up to the Wii MotionPlus to a Microchip PIC. Using information from the WiiBrew wiki, [DotMusclera] connected a PIC18F4550, an LCD, and a handful of components (mostly to do 3.3V level conversion), he set up the hardware on a breadboard. The only odd part you might have to work around is a Wii breakout board that converts from the breadboard to the Wii interface.
The software is easy to follow since it is written in Hi-TECH C and well-commented. The hardware lacks a schematic, but from the parts list and the video, you can probably figure it out. The setup works well and shows roll, pitch, and yaw on the LCD screen.
The project log is very detailed, with a lot of information about gyroscopes and the communication format the gyro uses. The video demo is worth watching as well.
Continue reading “Wii MotionPlus Gyro to Microchip PIC”
Microcontrollers existed before the Arduino, and a device that anyone could program and blink an LED existed before the first Maker Faire. This might come as a surprise to some, but for others PICs and 68HC11s will remain as the first popular microcontrollers, found in everything from toys to microwave ovens.
Arduino can’t even claim its prominence as the first user-friendly microcontroller development board. This title goes to the humble Basic Stamp, a four-component board that was introduced in the early 1990s. I recently managed to get my hands on an original Basic Stamp kit. This is the teardown and introduction to the first user friendly microcontroller development boards. Consider it a walk down memory lane, showing us how far the hobbyist electronics market has come in the past twenty year, and also an insight in how far we have left to go.
Continue reading “Before Arduino There was Basic Stamp: A Classic Teardown”
The hobbyist electronics market is still tiny, and even though random companies are coming out with some very interesting hardware, these parts and components aren’t exactly meant for us. The ESP8266 WiFi module is a slight deviation from this trend, with hundreds of different ESP dev boards floating around, and weirdos buying them by the bag.
[4ndreas] finally found the ESP8266 in a product; it’s not a very noteworthy observation until you realize how much work has gone into the development of open source toolchains for the ESP.
[4ndreas] found an RGB LED strip on Ali Express that could be controlled by WiFi. Inside, he found everyone’s favorite WiFi module, and by shorting two pins, he started up the controller in bootloader mode.
Because of the massive amount of open source development surrounding the ESP8266, there are a host of tools that can be used to program this cheap LED controller. [4ndreas] took a swing at writing his own firmware for the controller and came up with this project.
It’s not a killer project, but it does demonstrate the power of open source toolchains for cheap WiFi modules. This is only the first product found with an ESP8266 inside, but there are undoubtedly others out there just waiting to be taken apart and controlled in more advanced ways.
Continue reading “ESP8266 In Commercial Products”
Chances are, you probably know someone who uses a walker to assist in their mobility. Ever wonder about how they could be made better? When [Alan McFarland] noticed his friend using his iPhone as a light to walk down a hallway — with only one hand on his walker — he realized something could easily be done to make the walker more functional. His own light bar.
Sure you could get a flashlight, zip tie it to the walker, or maybe a bike light with a dedicated mount — but [Alan] wanted it to be a bit more elegant; and functional. With this in mind, he attached an LED light strip to the lower frame of the walker to help illuminate the path ahead. A button is wired up to the handle for easy access, and he’s even using a PIC12F1501 microcontroller to give it some logic — it’ll turn off by itself, fading out, giving the person a chance to sit down before the lights go out.
The thing we like about this project is he programmed it using the PICBASIC PRO compiler — the same compiler that [Alan] himself used nearly 20 years ago programming the Borg suits and spacesuit lighting on Star Trek: First Contact — how’s that for a random trivia fact!
[Hugatry] wanted to replace the adjustment pot on an LM2596 buck converter with a microprocessor-controlled voltage. The regulator IC uses a divider to generate a 1.25V reference from the output. The pot is part of a divider circuit that sets the output voltage. For example, if the divider is 10:1, the controller will keep the output at 1.25V and, therefore, the output voltage will be 12.5V.
[Hugatry’s] strategy was to use a filtered PWM signal from a microcontroller to offset the 1.25V signal. By adding a small voltage to the control point, the output voltage would not need to rise as high as before to maintain the 1.25V reference. For example, adding 0.25V to the reference input would only require 1V, which corresponds to a 10V output.
The video has a nice view of a scope showing the relationship between the PWM duty cycle and the output voltage. Although he didn’t mention it, it struck us that since PWM is proportional to the supply voltage, the voltage on the microcontroller and PWM output stage probably needs to be fixed. That implies you couldn’t use the buck converter to directly power the microcontroller itself. Then again, what kind of microcontroller needs to adjust its own power supply?
Continue reading “Microcontroller Adjustment of a DC to DC Converter”