I should really like I2C more than I do. In principle, it’s a brilliant protocol, and in comparison to asynchronous serial and SPI, it’s very well defined and clearly standardized. On paper, up to 127 devices can be connected together using just two wires (and ground). There’s an allowance for multiple clock-masters on the same bus, and a way for slaves to signal that the master to wait. It sounds perfect.
In reality, the tradeoff for using only two wires is a significantly complicated signalling and addressing system that brings both pitfalls and opportunities for debugging. Although I2C does reduce the number of signal wires you need, it gets dangerous when you have more than a handful of devices on the same pair of wires, and you’re lucky when they all conform to the same standard. I’ve never seen twenty devices on a bus, much less 127.
But still, I2C has its place. I2C was designed to connect up a bunch of slower, cheaper devices without using a lot of copper real estate compared to its closest rival protocol: SPI. If you need to connect a few cheap temperature sensors to a microcontroller (and their bus addresses don’t clash) I2C is a great choice. So here’s a guide to making it work when it’s not working.
Continue reading “What Could Go Wrong? I2C Edition”
$32 billion USD doesn’t buy as much as it used to. Unless you convert it into British Pounds, battered by the UK’s decision to leave the European Union, and make an offer for ARM Holdings. In that case, it will buy you our favorite fabless chip-design company.
The company putting up 32 Really Big Ones is Japan’s SoftBank, a diversified technology conglomerate. SoftBank is most visible as a mobile phone operator in Japan, but their business strategy lately has been latching on to emerging technology and making very good investments. (With the notable exception of purchasing the US’s Sprint Telecom, which they say is turning around.) Recently, they’ve focused on wireless and IoT. And now, they’re going to buy ARM.
We suspect that this won’t mean much for ARM in the long term. SoftBank isn’t a semiconductor firm, they just want a piece of the action. With the Japanese economy relatively stagnant, a strong Yen and a weak Pound, ARM became a bargain. (SoftBank said in a press release that the Brexit didn’t affect their decision, and that they would have bought ARM anyway. Still, you can’t blame them for waiting until after the vote, and the fallout, to make the purchase.) It certainly won’t hurt SoftBank’s robotics, IoT, or AI strategies to have a leading processor design firm in their stable, but we predict business as usual for those of us way downstream in the ARM ecosystem.
Thanks [Jaromir] for the tip!
Summer is now in full swing, which means that mowing the lawn once a week is starting to get old. So why not build a robot do it for you? That’s what [Blake Hodgson] did, and he’s never been happier. It only took him a couple of weeks of quality time at one of the local makerspaces.
[Blake] was showing off Lawn da Vinci at this year’s Kansas City Maker Faire. He had his own booth around the corner from Hammerspace, the shop where it all came together. [Blake] started with a standard push mower from a garage sale and designed a frame around it using OnShape. The frame is made from angle iron, so it’s strong enough that he can ride on the thing. To each his own, we say. The wheels and motors came from a mobility scooter and match the beefiness of the frame. These are powered by two 12v car batteries wired in series. He drives it around his yard with an R/C airplane controller.
Lawn da Vinci’s brainpower comes from two Arduino Pro Minis and a Raspberry Pi. One Arduino controls the motors and the R/C signal from the remote. The other runs some extra kill switches that keep the Lawn da Vinci out of trouble.
So what’s the Raspi for? Right now, it’s for streaming video from the webcam attached to a mast on the frame back to his phone. [Blake] says he has had some latency issues with the webcam, so there could be a pair of drone racing goggles in his future. He also plans to add a GPS logger and to automate part of the mowing.
Now, about those kill switches: there are several of them. You probably can’t have too many of these on a remote control spinning suburban death machine. Lawn da Vinci will stop grazing if it goes out of range of the remote or if the remote is turned off. [Blake] also wired up a dedicated kill switch to a button on the remote and a fourth one on a separate key fob.
The Lawn da Vinci is one of many example projects that [Blake] uses to showcase the possibilities of KC Proto, a company he started to help local businesses realize their ideas by offering design solutions and assistance with prototyping. Between mowings, [Blake] puts the batteries on a trickle charger. If you make your own robot lawn mower, you might consider building a gas and solar hybrid.
MicroPython is a Kickstarted project that brings Python to small, embeddable devices. As part of the terms of the Kickstarter, supporters were to get exclusive access to binary builds, with a few exceptions. Now it looks like the ESP8266-version is going to be added to the binary list. This is awesome news for anyone who enjoys playing around with the popular WiFi chip.
But even more heartwarming is the overwhelming response of the Kickstarter’s backers for making the binary builds public. Basically everyone was in favor of opening the binaries up to the general public, and many wrote that they wanted public binaries all along. People can be so giving.
But there’s also something in it for them! The more people get behind MicroPython, the more (free and paid) development support it will warrant, and the more bug reports it will garner. Wins all around. So keep clicking refresh on the binary list until you see it live. Or better yet, if you’re interested, head over to the forum. (Or just wait for us to cover it here. You know we will.)
As soon as he spied the Jolly Wrencher on my shirt, [Jerry Wasinger] beckoned me toward his booth at Kansas City Maker Faire. Honestly, though, I was already drawn in. [Jerry] had set up some interactive displays that demonstrate the virtues of his Pi-Plates—Raspberry Pi expansion boards that
follow the HAT spec and are compatible with all flavors of Pi without following the HAT spec. Why not? Because it doesn’t allow for stacking the boards.
[Jerry] has developed three types of Pi-Plates to date. There’s a relay controller with seven slots, a data acquisition and controller combo board, and a motor controller that can handle two steppers or up to four DC motors. The main image shows the data acquisition board controlling a fan and some lights while it gathers distance sensor data and takes the temperature of the Faire.
The best part about these boards is that you can stack them and use up to eight of any one type. For the motor controller, that’s 16 steppers or 32 DC motors. But wait, there’s more: you can still stack up to eight each of the other two kinds of boards and put them in any order you want. That means you could run all those motors and simultaneously control several voltages or gather a lot of data points with a single Pi.
The Pi-Plates are available from [Jerry]’s site, both singly and in kits that include an acrylic base plate, a proto plate, and all the hardware and standoffs needed to stack everything together.
We love little tricks like this. Suppose that you want to generate an IR remote’s signal. It’s easy, because most of the codes are known. But it can be slightly harder because most IR remotes and receivers modulate the on pulses with a square wave at roughly 38 kHz for background lighting immunity.
With a competent PWM generator on a microcontroller, you can create this carrier modulation easily enough yourself. Set the PWM frequency to 38 kHz and the duty cycle somewhere in the 33%-50% range, and you’re set. But what if you don’t have a competent PWM generator? Such was the case that prompted [AnalysIR Blog] to fake it, with USART.
Here’s the trick. You set up the serial port to communicate at ten times the desired carrier frequency, and then transmit “special” data. (The number ten comes from eight bits of data plus a start and a stop bit.) If you want a 50% duty cycle, you simply send
0b11110000, as fast as the microcontroller will allow, for a mark and nothing for a space.
There’s some extra detail with inverting the signal if, as most do, your USART idles high. But that’s really it. It’s a cute trick for when you’re desperate enough to need it. And if you’d like to brush up some more on your asynchronous serial skills, check out our guide on troubleshooting USART, and the great comments that ensued.
Sometimes when you build something it is because you have set out with a clear idea or specification in mind, but it’s not always that way. Take [kodera2t]’s project, he set out to master the ATtiny series of microcontrollers and started with simple LED flashers, but arrived eventually at something rather useful. An ATtiny10 DVM and DFM all-in-one with an i2c LCD display and a minimum of other components.
The DFM uses the ATtiny’s internal 16 bit timer, which has the convenient property of being able to be driven by an external clock. The frequency to be measured drives the timer, and the time it returns is compared to the system clock. It’s not the finest of frequency counters, depending as it does on the ATtiny’s clock rather than a calibrated crystal reference, but it does the job.
The results are shown in the video below, and all the code has been posted in his GitHub repository. We can see that there is the basis of a handy little instrument in this circuit, though with the price of cheap multimeters being so low even a circuit this minimal would struggle to compete on cost.
Continue reading “Hackaday Prize Entry: A Minimal ATtiny Voltage And Frequency Counter”