Using analog joystick in AVR projects

joystick

In many cases joystick manipulator is best choice for user input. Whether it is a game, robot or flying machine – joystick is most intuitive way of controlling them. You can actually find them in gaming controllers like PlayStation or XBOX. The one we are going to interface is Thumb Joystick I purchased some time ago from SparkFun. They are really cheap and as users report it is practically same as in XBOX 360 which can be replaces if one is broken. I didn’t bother making a PCB for it – just used a breakout board for it which also can be found on SparkFun. Simply speaking this joystick is nothing more than two potentiometers and one pushbutton. It is designed so that potentiometers are oriented perpendicular and thus moving stick you can have X and Y axis control. Push button is simply action button which can be activated by pressing joystick down. So controlling joystick is a matter of analog read of both potentiometers with microcontroller ADC inputs.

Continue reading

Using FreeRTOS kernel in AVR projects

FreeRTOS is known as Real-Time Operating System. Probably it would be too dare call it real-time-os, preferably a real-time scheduler where applications can be split into independent tasks that share full processor resources by switching them rapidly it looks like all tasks are executed in parallel. This feature is called multitasking. There are lots of debates on using RTOS on AVR microcontrollers as they are arguably too small for the running scheduler. The main limitation is a small amount of ram and increased power usage. If you are going to use lots of tasks in the application, probably you will run out of RAM that is used for saving context when switching between tasks. Consider FreeRTOS only if you use larger scale AVRs like Atmega128 or Atmega256. Surely you can find smaller schedulers that are specially designed for smaller microcontrollers even tiny series. In another hand, if you master FreeRTOS, it can be used with multiple types of microcontrollers like ARM, Cortex, PIC and various compilers including IAR, GCC, Keil, Rowley, Attolic. And the main reason to keep an eye on it – it is free. Probably it would take lots of time and space to go through RTOS theory.…

Continue reading

AVR DDS signal generator V2.0

Finally, the second version of the improved AVR DDS signal generator is here. First AVR DDS V1.0 generator was only an attempt of running the DDS algorithm without any analog amplitude control. In this DDS generator version, I still wanted to keep things as simple as possible using a minimum count of widely available components in the updated circuit. Also, I kept a single-sided PCB approach. AVR DDS specification AVR DDS signal generator V2.0 is a firmware-based DDS signal generator which uses slightly modified Jesper’s mini DDS algorithm which was adapted to AVR-GCC C code as in-line ASM. The AVR DDS signal generator has two outputs – one for DDS signal and another for high speed [1..8MHz] square signal – which may be used for reliving microcontrollers with wrong fuse settings or for other purposes where a high-speed square signal may be needed. High speed (HS) signal is output directly from the Atmega16 OC1A(PD5) pin. The DDS output is used for all complex signals that are generated via R2R resistor network and is adjusted via LM358N offset and amplitude regulating circuits. Two potentiometers can control offset and amplitude. The offset can be controlled in range +5V..-5V while magnitude in range…

Continue reading

DIY AVR Graphical LCD test board

Once I’ve got several HQM1286404 graphical LCDs around so I decided to build a prototyping board where I could easily plug LCD to it, read data via ADC and display graphs, plug keypad if needed for some menu functions. Earlier I was testing graphical LCD on prototype breadboard, but dealing with multiple wires (GLCD needs 20 of them) resulted in many failures. It is OK to do simple tasks, but more complex applications require a more stable platform. So here it is: This type of GLCD is standard 128×64 pixel matrix controlled by KS0108 LCD controller. Ones I have comes with smaller non-common pin-header where pins have 2mm step, so I had to draw it for Eagle library which you will find in project files. I decided to make a simple circuit so it could fit in 100x50mm single sided PCB. As base MCU I used Atmega16 which can be replaced with Atmega32 which is pin compatible with Atmega16 have more data memory.

Continue reading

Interfacing MPXV5100 pressure sensor to Atmega8

The MPX5100 series piezoresistive transducer is a state-of-the-art monolithic silicon pressure sensor designed for a wide range of applications, but particularly it is convenient to interface to microcontroller or microprocessor with A/D inputs. This is thin-film metallization, and bipolar processing to provide an accurate, high level analog output signal that is proportional to the applied pressure. More details can be found here MPXV5100 This sensor measures differential pressure comparing to atmospheric so when there is no pressure applied it shows 0kPa;

Continue reading

Analog Devices Digital temperature sensor AD7416

There aremany situations when you might need to measure temperatures or trigger some events due to temperature changes. It is very convenient to have these values in a digital format. Then you can transfer digital values to microcontroller to process data or jus to display on LCD screen. AD7416 Sensor description This is 10 bit digital temperature sensor which ca measure temperatures in range interval -40 to 125ï‚°C). Temperature conversion ADC has 15 conversion times. Sensor can be supplied from 2.7 to 5.5V, so it is no problem to connect directly to ARM microcontrollers. Data is transferred through I2C serial interface. More detailed description – datasheet can be downloaded from Analog devices page: AD7416. Here you find simple routine where Atmega8 microcontroller reads sensor data decodes temperature value and displays it on 2×16 LCD display. Lets connect everything to simple circuit. Don’t forget to connect pull-Ups to SCl and SDA busses: Here are few real images of prototyping: That’s it. If you would like to try to run this sensor by your own, here is source code of CodeVision compiler. And already compiled hex in archive. Also I added Eagle libray with AD7416 part in it. AD7416 Have fun 😉…

Continue reading