Recently, I was researching low-noise DC-DC converters and while reading Linear Technology Application Note 70 found this clever and useful circuit, designed by Jim Williams. The idea is to sense current in power inductor of the converter with another inductor, placed within short distance from the first one. The sensing inductor is connected to a circuit which amplifies and conditions the signal and generates nice clean square wave pulses which can be used to trigger oscilloscope sweep. The probe is isolated from the circuit preventing measurement corruption. As a bonus, analog output of probe amplifier allows observing current waveform through power inductor.
As is often the case with application notes, circuit description and build details are somewhat brief; I’m posting my notes hoping that the information will be helpful for other builders. Also, since BatchPCB doubled my order, I have extra PCBs; if anyone wants to build this circuit on a professionally made PCB with just couple green wires, e-mail me – the PCB can be yours for the price of postage.
PS3 controller connected to Arduino USB Host Shield
Another HID example has been added to Github repository of USB Host Shield for Arduino (which you can purchase in my store) . Richard Ibbotson sent me this nice piece of code along with some pictures. He also posted a short description of his sketch in comments section:
I wrote a sketch for the interface of the PS3 controller over USB. I have two controllers, one Sony and one Madcatz wireless with a USB dongle. Both of these work fine to the USB host shield. I only made one minor change to the library to increase the NAK count. The sketch tests all the function, buttons, joysticks, accelerometer/gyro, leds and rumble. This is not yet under bluetooth just USB. I can set the host bluetooth adddress on the controller though which is needed for bluetooth pairing.
Did not make much attempt to reduce code or data size, so only have about 4K of program space and 240 bytes of data space left, but sketch is pretty long. The actual PS3 part is very small and could be made to a small library.
Next is to move to the bluetooth part, from what I have found on the direct USB, I am pretty confident this will fit even on the 168.
PS3 controller support opens some very interesting possibilities. Not only can it be used as a normal “joystick plus buttons” type of control, but you can also utilize it’s accelerometer/gyro. With wireless variant of the controller all kinds of very powerful radio control are possible. Who is going to be the first to make a mechanical dog, which follows you around and brings back the controller when you throw it away?
If you want to try the sketch, make sure you have the latest library code as well – there are some small but important changes made recently in NAK handling.
MadCatz wireless controller to USB Host Shield
Wireless mini keyboard connected to USB Host Shield
Here is an interesting project which uses MAX3421E breakout board to connect XBox360 wireless controller to old Nintendo Entertainment System. Francois Gervais used Cortex-M3 as an interface between Nintendo and a game controller. There are two other videos showing the details of the setup – check them out as well.
Q. I am getting “USB device not recognized” error message – what do I do? Also, since the isolator is soldered into my circuit, “reconnect peripheral” suggestion seems too difficult to follow.
I decided to write this article after receiving several e-mails from people who bought my isolator. While setups described in those e-mails were different, the problem was the same – a PC refusing to recognize the device connected through the isolator. Here I will try to explain what is happening and also share my ideas how to troubleshoot and possibly fix the problem.
When nothing is connected to USB port, the bus is held at ground level with pull down resistors on the host side. USB device, when connected, pulls one of bus lines up, often times also with a resistor connected to Vbus and data line. Host sees it, sends bus reset and tries to query the device. If device is answering, host keeps querying the device and eventually enumerates it. When device is enumerated, application takes over.
If device is not answering (like for example, when self-powered device is turned off), host will give up and post “Device not recognized” message. To get attention from the host, we need to generate bus event, i.e., disconnect the peripheral and connect it back again.
I am continuing on topic of using USB Host shield to drive USB peripherals started in the previous article. The code presented here performs keyboard polls, character translation and management of “LOCK” keys – NumLock, CAPSlock and ScrollLock.
A keyboard is hard to use if results of typing can’t bee seen, so my first step was to add an output device. Even though HD44780-compatible character LCD can be driven with Arduino pins, I wrote a little library which uses GPOUT port of MAX3421E for LCD control. This library is now a part of USB Host Shield repo on github. I used LCD high-level routines from official Arduino distro and developed low-level functions specific to MAX3421E hardware, as well as LCD initialization. Since function syntax and behaviour (and source code ) is identical to official LCD functions, the user manual is already written and can be found in the library reference by title LiquidCrystal. The only difference is in the constructor; since only 4-bit mode is possible and only one pinout is supported, Max_LCD constructor is not accepting any parameters. The pinout of LCD connections to GPOUT is given in the Max_LCD.h file; see also title image of this article.
I noticed recently that I’m spending too much time building boards – it seems that my trusty air rework station just can’t work any harder. With ski season just a week away, I was looking at ways to minimize any work-related activity to save energy for skiing. As luck would have it, weather this weekend was extremely unpleasant – perfect time to stay home and upgrade my production to small scale plastic stencil/toaster oven process pioneered by Sparkfun and improved by many others. Below is my experience with it together with some pictures – enjoy!
In addition to typical household equipment – old decommissioned toaster oven, putty knife, paper towel, rubbing alcohol, and pair of good tweezers the process calls for two special items, which would have to be ordered in advance. One of it is a solder paste, another is a stencil to apply solder paste over PCB pads.
A Gerber for a stencil can be made from tCream layer in Eagle. This layer is generated automatically and works as-is with no modifications in most cases. However, if board contains packages with power pads, default footprint needs to be modified. Screaming Circuits has an article about proper QFN power pad solder paste pattern.
The stencil itself can be made from several different materials. Large scale production shops use stainless steel. Stainless steel stencil can be cut very precisely and work for many application cycles; it is, however, expensive. Another popular material is Mylar; it is not very durable but cheap. Kapton is more sturdy than Mylar (NASA used it as a micrometeoroid protection layer in space suits for Moon mission and Skylab project) and cost is roughly the same as Mylar – I prefer this material for my stencils.
In previous article I started talking about constructing magnetic stirrer from PC fan, a pair of rare earth magnets, and plastic can. In this article I will show the rest of the construction as well as program code to control the motor.
When building cases for my designs, I tend to avoid techniques requiring accurate (read “any”) measurements and calling for non-round holes. The design that I’m describing here is no exception. In order to complete it I needed just a few extra parts in addition to plastic joint compound can, PC fan and magnets, arrangement of which was described earlier. I used Arduino controller equipped with Motor Shield from Adafruit to supply PWM current to the fan, 3 nylon standoffs with adhesive bottoms to mount Arduno, rotary encoder to set stirrer speed, and panel-mounted 2.1mm DC power jack. The stirrer is powered from 12V wall wart capable of supplying 300mA or more.
I was thinking of implementing monitoring of motor current to track the moment when stirrer bar loses attraction to the magnets and stops rotating. When I was playing with the stirrer powered from bench suplly the change in current was quite visible. However, I found out later that when motor is supplied with PWM signal, current stays almost constant over the whole range of duty cycles and loads and current tracking won’t work. With regret, I abandoned this clever feedback idea. On the bright side, the code necessary to control the stirrer immediately became much simple, short and easy to understand.
Immediately after announcing USB Isolator circuit I received several suggestions to put together a parts kit. Indeed, users of such devices are usually not afraid of small parts and generally aware of which side of soldering iron is better suited for holding on to. Also, I’m having hard time trying to find a supplier, where one can buy all the parts to build this circuit; usually, you need to buy from 2-3 suppliers, which significantly adds to shipping expenses. Considering this, I’m now offering not one, but two parts kits to build an USB Isolator based on Analog Devices’ ADuM4160.
The kits are added to “ADuM4160 USB Isolator bare PCB and kits” dropdown. One kit contains all the parts necessary to build an isolator – PCB, ADum4160, capacitors, resistors, USB connectors, pin headers, and jumpers and costs $25. Another kits contains all that plus all parts for 5V buck converter – LT1376-5, inductor, caps, etc and costs $33. Enjoy!
I’m not writing a build manual at this time; I’d like to get some feedback from builders first. Any questions you have, please don’t hesitate to ask.
[EDIT] This post is about legacy product which is no longer supported. Visit USB Host Shield project page for up-to-date information[/EDIT]
Arduino USB Host Shields are in the store. If you are not yet familiar with the project, please browse “USB Shield” category of the site and read the articles. In short, the purpose of this shield is to add USB Host interface capability to Arduino. The software libraries for this shield currently support control and bulk-in transfers, while bulk-out transfer is in the works. Access to GPIO pins of MAX3421E is also supported. Sketch examples, demonstrating USB device control queries and polling USB keyboard, are published. More code will be developed in the future.
At present, four configurations of the shield are available. The first one, called “Minimal”, contains USB core components only. It is compatible with 3.3V Arduinos, such as Arduino Pro from Sparkfun. Also, since no 5V is available, only communication with self-powered devices is possible. Moreover, not every self-powered device would work in this configuration. For unknown reasons, some external hard drives refused to answer until VBUS voltage was raised to 5V. On the other hand, all printers and digital cameras that I and several beta-testers tried worked fine as well as other people’s external hard drives. “Minimal” configuration is the best one for battery-powered projects since 3.3V Arduinos consume less electricity.