Articles tagged 'Electronics'

Blog Projects

Driving 595 Shift Registers

595 series shift registers come in many flavors. SN74HC595 is the most usual. TPIC6B595 is similar but can be used with more power hungry applications. Pin layouts are different but they all operate in the same way.

Shift register is controlled with three pins. They are usually called DATA, LATCH and CLOCK. Chip manufacturers have different names. See the table below for two examples from Texas Instruments.

74HC595 TPIC6B595

Continue reading >>

Simple Serial Communications With AVR Libc

I like to use various Arduino boards for AVR development. What I do not like are the Arduino libraries. They are often just wrappers around libc functions or rewrites of functions libc already provides. Serial communications is one good example. Arduino provides you with its own implementation of Serial.print(), Serial.println() and methods. At the same time AVR Libc has proven printf(), puts() and getchar() functions. This article explains easy implementation of libc functions used for serial communications.

If you do not have much experience in programming it is probably better to stick with Arduino libraries. They are good at hiding some of the confusing features of embedded programming. However changes are you grow out of them after few projects. Atmel datasheets are not as confusing as they first appear. You might also want to check the finished code of this article.

Configuring UART

AVR microcontrollers have three control and status registers. Register UCSR0A mostly contains status data. UCSR0B and UCSR0C contain all the configuration settings. See the tables in the end of article for all possible values.

AVR Libc provides helper macros for baud rate calculations. Header file requires F_CPU and BAUD to be defined. After including the header file UBRRL_VALUE, UBRRH_VALUE and USE_2X are defined. First two are used to set UART speed. Last one is used to determine if UART has to be configured to run in double speed mode with given baud rate.

UCSZ20 UCSZ01 and UCSZ00 control the data size. Possible sizes are 5-bit (000), 6-bit (001), 7-bit (010), 8-bit (011) and 9-bit (111). Most common used data size is 8-bit.

With above bits we can set most common configuration: no parity, 8 data bits, 1 stop bit.

Continue reading >>

How Does Led Matrix Work?

Led matrices are fun toys. Who would not love blinkenlights? Electronics is hard. Electronics is much harder than programming. I had hard time trying to understand how do the led matrices work. What is best way to learn something? Build one yourself.

Structure of Led Matrix

In a matrix format LEDs are arranged in rows and columns. You can also think of them as y and x coordinates. Lets assume we have 4×4 matrix. Rows would be marked from A to D and columns from 1 to 4. Now we can address each LED by row and column. Top left led would be (A,1). Bottom down led would be (D,4).

Led matrices come in two flavors. Common-row anode (left) and common-row cathode (right).

Figure above shows the different configurations. The difference between these two configurations is how you lit a led. With common-row anode current sources (positive voltage) are attached to rows A..D and currents sinks (negative voltage, ground) to columns 1..4. With common-row cathode current sinks are attached to rows A..D and currents sources to columns 1..4.

For example. To light bottom down led (D,4) of common cathode matrix you would feed positive voltage to column 4 and connect row D to ground. For sake of clarity I will using common-row cathode in examples for the rest of this article.

Continue reading >>

Built using the awesome Flat UI Pro framework by Designmodo.

Mika Tuupola is a Member of the Leanpub Affiliate Program.

© 2014 Mika Tuupola.