All posts by Avinash

About Avinash

Avinash Gupta is solely focused on free and high quality tutorial to make learning embedded system fun !

Time Input Dialog for Graphic LCD

GUI Frameworks of all modern OS like Windows, Linux (Qt & GTK+), MAC etc have a concept of standard dialogs. For example all applications running under Windows shows the same file open dialog for selecting a file. Similarly their are standard dialogs for folder selection, colour selection, font selection etc. This concept has several advantages, and the most important is a easy user interface. Since the user is already familiar with file selection in one application, he/she can use file open dialog of any application. Building on the same concept our GUI framework for ProGFX (avr glcd driver) will too have many standard dialogs for common user interface. In this tutorial we will build the "Time Input Dialog" that helps programmer ask the user to input time. The time could be anything like :- "On" or "Off" time for a relay in a timer application. Alarm time in an alarm clock application. Period start time in a school bell application. And many others. The programmer just need to call the function. void ShowGetTimeDlg(uint8_t *h,uint8_t *m,uint8_t *s,uint8_t *am_pm) It takes four parameters hour, minutes, second and am_pm. All parameters are passed by reference(pointer actually), this is because the function modifies the value of those variables. It shows a dialog as shown below :- Time Input Dialog The user can use the […]

DS1307 I2C RTCC Interface using SoftI2C lib

In the last tutorial, I explained you how to use our SoftI2C library to read and write a 24CXX series I2C EEPROM. Now I will continue our exploration and write a register access layer for the DS1307 chip. The DS1307 chip is a real time clock and calendar IC. The register access layer that we will develop provides the application programmer with function that reads and write the registers of DS1307. Remember that any piece of hardware appears to the CPU as a set of registers only. DS1307 has :- Seven Registers (from 0x00 to 0x06) that are used for timekeeping functions. One CONTROL register(0x07) for square wave generation setting (we don’t use this for simplicity). 56 bytes of battery backup RAM (from 0x08 to 0x3F) Fig. : A Simple DS1307 RTC Module.   Once the application programmer has access to functions that reads and writes to any register (specified by its address) inside DS1307 ic, he/she can easily get and set the time infos like sec,min,hour, am/pm, date,month,year etc. The register access layer is built over the core Soft I2C layer. The register access layer consists of the following three functions. void DS1307Init(void) { SoftI2CInit(); } /*************************************************** Function To Read Internal Registers of DS1307 ——————————————— address : Address of the register data: value of register is copied to this. […]

24C1024 I2C EEPROM 128KB

24CXX I2C EEPROM Interface using SoftI2C lib

In this tutorial I will show you how to use our easy to use open source Soft I2C library to access a 24C64 EEPROM chip. We discussed the library in our previous tutorial. The functions developed in this tutorial will use services of the I2C library to read and write the EEPROM. The EEPROM access mainly contains only two routines. BOOL EEWriteByte(uint16_t address,uint8_t data); BOOL EEReadByte(uint16_t address ,uint8_t* data); The first one write a 8 bit data to a memory location specified by the variable address, since a EEPROM can have more that 256 bytes of storage that is why the address variable is 16 bit. The second function reads the memory location specified by the variable address and stores the read data in variable data. Both the function return EE_SUCCESS on success and EE_IO_ERROR on failure. How to develop the EEPROM Write function? We open the datasheet of 24C64A (64kbit) EEPROM and try to understand the random read and random write function. The figure 8 on page number 11 clearly describes the write steps. You just need to translate the figure into proper call to our Soft I2C lib API’s. BOOL EEWriteByte(uint16_t address,uint8_t data) { SoftI2CStart(); //SLA+W if(!SoftI2CWriteByte(EEPROM_WRITE_ADDRESS)) { SoftI2CStop(); //I2C i/o error return EE_IO_ERROR; } //Address HIGH if(!SoftI2CWriteByte(address>>8)) { SoftI2CStop(); //I2C i/o error return EE_IO_ERROR; } //Address LOW […]

Software I2C Library for AVR MCUs

Inter IC Communication or I2C is a two wire serial communication bus used to connect a variety of external peripheral with a microcontroller. Most common are EEPROMs, RTC, Port Expanders etc. Most leading MCUs comes with at least one dedicated I2C host adaptor built in. But some times we need more than one I2C interface or we need I2C lines on some other i/o pins than those allotted to the hardware I2C, in that case we need to go with a solution called SoftI2C. In SoftI2C the I2C signals are handled in software, the advantage is that any two i/o line of the MCU can be used for communication. The drawback is that it need more CPU cycles are wasted in generating the signal thus less time slice is available to the application. In this article we will present our open source, flexible and easy to use SoftI2C library. This library can be used to connect any I2C slave device with an AVR (and latter PIC MCU) MCU. Some limitations of the library are :- No Multimaster support. No clock stretching support. But you can connect multiple number of I2C Slaves on the same bus. I2C Master/Slave Connection The Soft I2C Library for AVR The soft I2C library for AVR comes in two files. i2csoft.c i2csoft.h The configuration section lets […]

Tracked Wheel Robotics Platform

Tracked Robot, Chain Links   Tracked Robot, Chain Links   Chain Links Connected   Metal Connecters   How to connect chain links.   Complete Tracks with 18 links These tracks then can be fitted on the wheels. The track wheel set comes with the chain links, metal connecter and four plastic wheels. For more details check out Track Wheel Set for hobby robotics. Tracked Wheels   A complete mobile platform. The above platform is a four wheel drive, using 200 RPM Gear DC Motors on all four wheels. Bottom View   Gear motor for robots Other wise if you want to control the cost you may use dummy motor in place of two front motors. Dummy Motor Shaft The platform was built over the High Quality Metal Chassis. The Chassis

eXtreme Burner Goes Social !

eXtreme Burner AVR is Now on Facebook. You will notice the new Facebook button on the toolbar. Visit eXtreme Burner AVR’s Facebook page. We hope you will it. eXtreme Burner – AVR Goes Social ! Other features added in version 1.2 New Icon set. Fuse bit editor, lets you view the name and function of each bit in fuse bytes. Also you can toggle bits with double click. AVR Clock Configuration tool, lets you easily select from various clock types. Also lets you select the start-up times. Auto AVR Clock Configuration Utility   Fuse bit editor Download eXtreme Burner AVR v1.2 Now !

STM32 Project – Digital Photoframe

This is our first advanced project using a powerful 32bit MCU and all sort of modern technologies like Colour QVGA display, Micro SD Card and Embedded file system. We have made several project using 8 bit PICs and AVRs but those were simple and didn’t use modern displays. In today’s world every one owns several gadgets like cell-phone, tablets, media players, hand held gaming device, digital cameras that uses TFT LCDs and uSD storage. So I thought current DIYers should be dreaming of using them in their own design too. This created the need for a DIY project that should help experimenters use such technologies. So I designed a simple ARM project called the "STM32 Digital Photo Frame". Project Description You need to place some BMP format images in the folder "slideshow" in the root of MicroSD card. After that install this MicroSD card in the card slot. Then power up the board using a USB Port. The images will be shown on the QVGA TFT Screen one by one. Their will be an approximate delay of 2 seconds between display of each image. Once all the images have been displayed, the sequence will restart from the first image. The slideshow will continue until the power is removed. Note: In the current version, the BMP file must be 24 bits […]

A Basic Touch-screen driver for STM32

Today I completed the basic touch screen driver. The task included Learning the "Theory of Operation" of 4 wire resistive touch screens. Learning the about the working of AD7843 touch screen controller IC. Learning about the SPI peripheral of STM32 Writing basic SPI drivers (to init, read and write to SPI1) Writing basic drivers to command and read AD7843 touch screen controller. Filtering the touchscreen data using Median Filter to remove noise. Learning about the three point touch screen calibration method. Writing a routine to convert touch screen co-ordinate (ranges from 0-4095 in X and Y direction) to LCD co-ordinates. Finally ploting a cross-hair at the touched point. The final result is shown below. Then I moved on to implement a GUI 3D Button. After that I went to try a “Free Hand Drawing” application. And what I made is shown in the video below.

New 28 PIN AVR Development Board

We have launched a low cost 28 PIN AVR Development board for those you want to get started with AVRs on a budget. As this board provides a clean circuit for basic AVR connection you can learn to program hello world app (a LED blinky) in just few hours! If you are tired of wiring the basic AVR connection for every project, this board can save you a lot of time. You can order it from the online store and pay using Indian Debit Cards (or ATM Cards) or Netbanking. The board will be delivered to your door steps in 3-5 days any where in India. 28 PIN AVR Development Board.   28 PIN AVR Development Board. Buy 28 PIN AVR Development Board at Rs. 249 Only Features: Compatible with 28 pin chips like ATmega8,ATmega48,ATmega168, ATmega328 etc. Atmel AVR ATmega8 28 PIN microcontroller Included. 16 MHz crystal for maximum speed. All ports available on standard 0.1inch (2.54mm) male headers. LC Filter on AVcc for clean ADC performance. Decoupling capacitors on all power pins. Standard ISP Header (Can be programmed with our USB AVR Programmer v2.0). On/Off switch. 9-18V DC input. 5v regulated output for supplying extra peripherals.(3x). Reset Button. Power Indicator LED. Free Prototyping area for customization(78 holes at 0.1 inch distance) FR4 PCB with solder mask and silkscreen. All […]

Got the TFT LCD + STM32F103VE MCU Up and Running !

Hi All, I was working to interface 320×240 pixel TFT LCD based on ILI9325 controller with my 32 bit ARM MCU (STM32F103VE). Got to digest the whole datasheet of ILI9325, Learn about the FSMC (Flexible Static Memory Controller). Finally succeeded in initializing the LCD and writing to the GRAM. Then ported a part of ProGFX (Text and Font unit) to this new platform. Finally was able to write text on the LCD Screen. This is part of a bigger project to port BASIC language for STM32 MCU based single board computer with on board LCD and SD card. The user then can program in BASIC language, store .BAS files on SD card and execute on board. Something like a power packed Arduino for the modern world (TFTs, SD Card and Multimedia!) Now the next part is to get a basic GUI up and running to view and load BAS files from SD card. After that main task of porting basic begins!