How to sprintf float numbers with AVR GCC

The float numbers are not recommended to use with smaller 8-bit AVR microcontrollers. The main reason is that the AVR core does not have a floating-point arithmetic unit built-in. The software library emulates the floating-point arithmetic operations. The software library simulates Floating-point arithmetic operations. However, in real-world applications, you may need to use numbers with floating-point. In some particular cases, you can get away without you declaring variables as float type. If operations are simple like division or multiplying by 2, 4, 8, they can be replaced by the byte shift operation (byte<<1)=byte*2 Of course, it depends on the different situations and data you are manipulating – sometimes using floats is inevitable. If your code fits into Program memory and execution speed is not critical, use floats or double number formats, as you like.

Continue reading

Show Your Talent by DIY a Sun Tracking Unit

Probably you saw the Sun tracking system before; however, do you have the urge to challenge yourself to make a Sun Tracking Unit? First of all, get a tiny .7″x1.4″ PC board using the LED3X sensor concept. This circuit uses power MOSFET drivers, which most any DC motor can be used without any modification. You might notice that the power drivers are good enough for delivering about 50 amps of peak current or even more. The current will increase accordingly to the transistor. This means the large power MOSFET, 72A, when operated in low power mode, will eliminate the transistor’s need for a heat sink. Cool, isn’t it?

Continue reading

Safety Protection Guides and Fact about Microcontroller You Should Know

Microcontrollers are widely used in nowadays electronic and modern devices. You can track them whether for personal use for fun or even for serious and confidential applications by banks, security services, government authority, or the military field. Most of the algorithm that uploaded into its memory is well written in Assembler. Many villains out there want to hack or attack the microcontroller, maybe just for fun or for their own purposes (some of them willing to hack and sell the top-secret from companies for profitable) To reduce the risk of being attack by these microcontroller hackers, that is why we must know the types of attack categories.

Continue reading

Microcontroller Development tools on USB stick

Looking for compact but flexible, simple, and cheap development board? You should consider this nice list of microcontroller USB-Stick tools. These are special development tools that include all necessary hardware and software in a portable USB stick. Most of them consist of two parts – a USB stick and attachable target board. For instance, eZ430-RF2500 is the world’s smallest low-power wireless development tool. At only $49, the device includes a USB emulator to program and debug your application in-system and two 2.4-GHz wireless target boards featuring the highly integrated MSP430F2274 ultra-low-power MCU.

Continue reading

Voltage references in embedded design

Embedded systems that are dealing with DAC require good voltage references. Despite all voltage references having their nominal values, specific tolerances indicate how much values can vary from the nominal value. References, as a rule, are semiconductors that characteristics are affected by temperature. For instance, if we decide to use a 2.5V voltage reference then (Zener) diode LM336A-2.5 may be a good choice for this. These diodes have a low-temperature coefficient. It can guarantee that voltage will be in the range between 2.44 and 2.54 at 25ºC. This precise Zener diode has a third lead that can be used to adjust break down voltage. In the following figure, you may see a diode with a potentiometer where breakdown voltage can be adjusted in the range of ±120mV:

Continue reading

Yet Another Simple AVR ISP cable

Probably this programmer cable can be found on every AVR fan website. It is straightforward and easy to build. You need a few passive components that can be packed inside the LPT connector. From my perspective, I wouldn’t recommend using this one ISP programmer if you are more serious about microcontroller projects because it has poor computer port protection. It connects directly to the LPT port without precautions. I recommend using a similar ISP circuit with buffer IC between LPT and target board. But let’s don’t pretend like we are brilliant. The whole beauty is in its simplicity. This thing does its job perfectly as long as the target board power supply is OK.

Continue reading

USB bootloaders for AVR microcontrollers

Probably the most proper microcontroller programming method is using a bootloader program. Because you don’t need any special programming adapters or special knowledge – you need to connect a standard cable from your PC to the target board and run a special program on the PC which communicates with the MCU bootloader program. The idea is simple: If the microcontroller is preconfigured, then after reset, it starts running not from the start memory location, which is usually at 0x0000 address, but at some specific location, where usually bootloader lies.

Continue reading

Architecture of a Typical Microcontroller

Microcontrollers are the building blocks of any digital signal processing system. In layman’s terms, they can be described as miniature computers that are present on chips. They consume very little amount of power and are self sufficient. They are similar to microprocessors but contain some additional elements such as read only memory in the form of EEPROM (Electrical Programmable Read Only Memory) and a read write memory that usually utilises flash technology. Another difference between microcontrollers and microprocessors is the clock speed. Microcontrollers usually operate at low clock speeds. Low clock speeds are adopted as they are suitable for the operations that are usually performed using microcontrollers. Also, this ensures that they consume less power.

Continue reading