Monday, September 28, 2015

Getting data from ADXL345 From USART - ATmega32




A small update on Interfacing ADXL345 with ATmega32, this program will get raw data from ADXL345 working on I2C mode and send the data over USART.

To recieve data to PC over USART see this.

Saturday, September 26, 2015

AVR Dude


AVRDUDE is an excellent program for programming a AVR Atmega series microcontroller. In order to program any microcontroller you need to have a *.hex file which contain the instructions for the microcontroller. Apart from the software you need to have a hardware connection between your PC and the microcontroller which acts as an interface to write the *.hex file into the memory of the microcontroller, from where it run the instuctions in the specified *.hex file. USBasp is an awesome programmer found at cheap cost on almost all online stores these days. So you need a programmer like USBasp, some basic circuit for the ATmega and a PC with AVRDUDE and *.hex file to start the programming the microcontroller.

Wednesday, January 15, 2014

OpenFOAM - blockMesh

Please read OpenFOAM - Basics before reading this post

blockMesh is a mesh generation utility supplied with OpenFOAM. In simple word it generates mesh for the CFD analysis. In the last post it was said that the basic OpenFOAM case directory consists of three folders namely 0, constant and system. The blockMeshDict file in the constant/polyMesh directory of the case file contains the parameter of the geometry and the parameters required for meshing the surface. Now go to the forwardStep directory which is discussed in the previous post and open the blockMeshDict file. In the file u scan see may sections like FoamFile, vertices, blocks, edges, etc.,

Sunday, January 12, 2014

Advanced USART Functions


In the previous post the USART_Transmit_char function can only send one character at a time. If you want to send a whole sentence or an integer or a non-integer you cant use the above function. Here are some code snippets that come in handy while using USART.

Sunday, October 20, 2013

USART with ATmega32

Introduction

The Universal Synchronous and Asynchronous serial Receiver and Transmitter (USART) is a highly flexible serial communication device. It is the easiest way to communicate with a computer. Many softwares such as MATLAB, Scilab, Mathmatica, etc., provide libraries that support serial communication. Real time data logging can be easily done due to its speed and flexibility in features. The USART uses two lines Tx and Rx, the data is transmitted through the Tx line and received through the Rx line. Let's see how to make ATmega32 communicate with a laptop.

ADXL345 Accelerometer using ATmega32

The ADXL345 is a tiny, low cost and ultra-low power 3-axis accelerometer which works on both SPI and TWI interfaces. It has use selectable sensitivity and give quite reliable readings considering its cost. The ADLX345 circuit in the IMU has TWI interface. I will be using ATmega32 in the following project clocked at 8MHz using the internal oscillator.
Here is the circuit diagram of how the ADXL345 accelerometer is connected, also you can see that the slave address is given as 0x53. The address can also be found out from the I2C scanner as shown here.
The ADX345 supports the standard (100 kHz) and the fast (400 kHz) data transfer modes. For more info see datasheet.

Tuesday, October 15, 2013

I2C Scanner

The fast and easy way to find out the i2c devices connected to arduino. It also helps to find out whether the wiring is correct or not, usually people tend to interchange the SCL and SDA wire and waste a lot of time.

Wednesday, September 18, 2013

Souce Code formatter for blogger

Here are some sites that help you to convert your code snippets into html format. The code is converted into a tabular format.

Interfacing HC-SR04 Ultrasonic Module with Arduino Pro Mini

SR04 is a module that can detect distance between 2cm to 400cm by sending out ultrasonic waves and calculating the time between the sent signal and echo received.


Steps:
  1. Send the trigger signal - a TTL 10us signal
  2. Wait for the echo pin to get high.
  3. Calculate the time for which the echo pin is high using a timer.
  4. Calculate the distance using 
Distance = high level time * velocity (340M/S) / 2

Saturday, May 11, 2013

V-USB



V-USB is a software-only implementation of a low-speed USB device for Atmel’s AVR® microcontrollers, making it possible to build USB hardware with almost any AVR® microcontroller, not requiring any additional chip.

More Info can be found out here

Sunday, November 18, 2012

Sunday, November 11, 2012

BEAM Robotics

BEAM (Biology Electronics Aesthetics and Mechanics) Robotics , it is an approach to robotics using simple analog circuits rather than using micro-processors or micro-controllers. This concept uses a type of circuit configuration which mainly consists of a neural network referred as "Nervous Net" or "Nv Net" whose element are none other than artificial neurons.

Why??
Reduce the cost and complexity of the design. It takes less time to build a Beam-Robot rather than designing traditional machines, also the size of Beam Robots are smaller than traditional robots.

Nv Neuron ???
Artificial neurons are made of a resistor, capacitor and a NOT gate.

Thursday, November 1, 2012

ATmega32's Internal EEPROM


The EEPROM is an area of read/write memory that is non-volatile i.e., the stored data is not lost even if you power off the device.

The ATmega32 has a inbuilt EEPROM in it . Before starting to learn about using the internal EEPROM, let's get to know about the risk's that involve in using a Internal EEPROM.

  1. Internal EEPROM might get corrupted while the power is being switched off.
  2. Supply voltages are likely to rise or fall slowly during power up or down, this causes the device to operate at a voltage lower than the specified minimums voltage for the clock frequency used. This might lead to an unintentional write of the EEPROM.

Thursday, October 25, 2012

PWM with ATMEGA 32


PWM - Pulse Width Modulation.

The basics about PWM can be read here

Why PWM??
Suppose you have a motor with a certain torque and RPM, and you want to change the RPM. This can be done easily by reducing the voltage supplied, but due to this even the torque of the motor reduces. So, how to control the RPM of the motor without compromising on torque ???
The answer is PWM - Pulse Width Modulation

Thursday, October 18, 2012

Processing - Open Source Programming language


Accidentally came across this new language Processing (weird name), mainly based on graphics programming and really simple to use. Processing is built by the electronic arts and the visual design communities with the purpose of teaching computer programming in the visual context. Though built on the Java platform the syntax is drastically simplified.

Here are some images of a snowflake fractal made using processing
4 Iteration