Learning about accelerometers and gyroscopes

Accelerometers and gyroscopes are commonly used sensors where some sort of balance is needed. Combination of both in one board is called IMU (Inertial Measurement Unit). You will find one on flight controllers, balance modules and in many other areas. If you are going to build something from scratch then you should know some background information on how to interpret readings and how to use them in control. Gadget Gangster have shared pretty good instructable where he explains how to interface IMU device to microcontroller and how to use this data to get desired results.

IMU_tutorial

As example he uses Acc_Gyro board with LIS331AL triple axis accelerometer and LPR550AL dual axis gyroscope. He goes through some math while explaining how to determine orientation of IMU using either only accelerometer data or combination with gyroscope readings. Plus gyroscope gives some clue about rotation around one or another axis. SO if you are thinking of building inertial system, you should do your homework and understand hos things work.

Using potentiometer instead of rotary switch

Using rotary switch in embedded design can save board space and in same time be very intuitive. With knob turn you can change parameters, go through menu and do all sorts of things. But rotary switches aren’t low cost solution. Since most microcontrollers already have ADC integrated, why not replace it with simple potentiometer. This is what Claude Haridge suggests in his example.

switch_to_pot

There are several benefits of using potentiometer instead of rotary switch. First of all you only need one MUC pin. This already gives a chance to choose smaller micro. Also with potentiometer you dont have bouncing problem. Another benefit is that this is cheaper way. But you also loose some benefits of switch. First of all you loos detent feel of switching – hard to determine switching positions as you turn potentiometer. Another thing is that you need more sophisticated algorithm to read switch states. It is worth considering to use potentiometer in cheap solutions.

Do not skip bypass capacitors

If you are designing some circuits, you probably know or by intuition add bypass capacitors to every IC power rail. Almost everywhere you will find scarce info that you need to place cap as close to IC as possible. In order to get deeper understanding why these caps are needed, sana syed on electro-labs wrote a tutorial about bypass capacitors explaining the meaning of it and what size of capacitor is needed.

bypass-capacitor

The main reason why bypass capacitors are used is to filter out high frequency noise and glitches from DC voltage. It can be power supply or DC biasing. If you know fundamental electronics, then its clear that capacitor allows AC to pass while stops DC. So if carefully selected capacitor it passes high frequency noise directly to ground and leaves DC voltage cleaner. It turns out that not any capacitor will do its work as expected. Some calculations may help refine the choice and filter out undesired AC noise or simply pass AC signal without affecting DC part.

Resetting Arduino via serial line

Normally Arduino boards are reset by using additional DTR line of serial interface. This becomes a problem when USB-UART adapter doesn’t support DDR line. And you probably read many cases were one or another particular cable won’t work for programming, but can be used for simple serial data transfers. Ralph thought that there should be another solution that would allow using any serial cable for programming. He thought that TXD and RXD lines are always available since they are used for data receive and transmit. So why not to use one of those to reset microcontroller.

Serial_Auto_Reset

With three additional discretes he created a simple circuit that would stand between RXD data line and RST pin. This is simply an RC circuit that would discharge cap during some time. So when data line works in normal operation – RSTin isn’t affected due to slow cap discharge. But when RST signal is held down for longer time – cap is discharged and then RST signal is sent. Since he’s done modifications, he also had to do changes in AVRDude configs. That turned out to be fairly easy. Overall this is quit smart solution that could be considered as option on any Arduino board, so we wouldn’t need to hunt for specific serial adapter cables.