New STM32F103ZET6 development board with 3.2″ TFT Touch LCD

The latest development board has just arrived. I thought it would be nice to push things more towards the ARM cortex-M3 playground. This an STMicroelectronics STM32F103ZET6 ARM Cortex – M3 MCU based development board with a 3.2” Touch LCD screen. This is a high – density performance line 32 -bit MCU featuring internal 512K of FLASH memory, 64K of RAM. It is rich in peripherals like USB, CAB, 11 timers, 3ADC, and many communication interfaces. The microcontroller seems to be powerful enough to run quite intensive tasks, but more memory is populated on board. Additionally, there are:

Continue reading

Running multiple FreeRTOS tasks on AVR

In the previous post, we just run a single task. Running RTOS with a single task has no meaning at all. This can be quickly done with a conventional program. But what if we need to have more separate functions. To execute them at exact timing would require a separate timer or interrupt. But microcontroller cannot guarantee an interruption for every task. This way, it is hard to make code modular, and testing can be painful. Using RTOS solves this kind of problem. It allows programming each task as an endless loop. Kernel scheduler takes care of assuring each task gets its chunk of processing time. Additionally, it does bearing the priority systems – more critical tasks are executed before less important ones. Let us go further with our example code and add more tasks to our FreeRTOS engine. We already have an LED flashing task that toggles LED every second. Additionally, we are going to create another task that checks the button state. Also, we are going to send some information to the LCD. As always, let’s take care of drivers for all of them.

Continue reading

Using FreeRTOS kernel in AVR projects

FreeRTOS is known as Real-Time Operating System. It would probably be too dare to call it real-time-os, preferably a real-time scheduler where applications can be split into independent tasks that share complete processor resources by switching them rapidly. It. It looks like all functions are executed in parallel. This feature is called multitasking. There are many 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 use lots of tasks in the application, you will probably run out of RAM to save context when switching between tasks. Consider FreeRTOS only if you use larger scale AVRs like Atmega128 or Atmega256. Indeed you can find smaller schedulers that are specially designed for smaller microcontrollers, even tiny series. On the other hand, if you master FreeRTOS, it can be used with multiple microcontrollers like ARM Cortex, PIC, and various compilers, including IAR, GCC, and 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. Some great information can be…

Continue reading

Can vs LIN bus interfaces in automotive electronics

Modern cars have more electronics than you can think of. Almost every vital part has tons of sensors on it with a dedicated computer called ECU (Electrical Control Unit). Usually, there are from several up to hundreds of ECU’s in a single car. Especially luxury ones. All modules have to work as an organized unit. So this is where a reliable connection interface is needed. Probably you’ve already heard of CAN bus (Controller Area Network). It is a standard bus interface used in most vehicles where the board computer communicates with separate control ECUs taking care of the engine, gearbox, climate, security alarm, and safety bags. CAN devices are connected by using twisted pair signal wires that are more resistant to noises. Signals usually operate at the 5V level. The transfer speed can reach up to 1Mb/s for 40m cable lengths.

Continue reading

MSP-EXP430FR5739 board have just arrived

Over a week ago, I got a notice that Texas Instruments (TI) is giving away a 50% coupon for MSP430_FRAM related devices. Without hesitation ordered their MSP-EXP430FR5739 TI experimenters board that price went down to $14.50, including free shipping. With all functionality and onboard peripherals included – it’s a giveaway. The experimenter’s board came in an excellent complex paper package that feels really solid and professional in hands.

Continue reading

How to drive servo motor control with AVR microcontroller

Servo motors are so-called “closed feedback” systems. This means that the motor comes with a control circuit inside, which senses if the motor mechanism is in the desired position. If not, it continuously corrects an error until the motor reaches the angle. Servo motors are widely used in robotics, remote-controlled planes, vehicles, and many other industrial machines. They come in many shapes and sizes, but they all operate in almost the same way. Usually, servo motors are controlled by a computer, microcontroller, or even a simple timer circuit. How Servo Motor Control Works Usually, servo motors are put in the plastic box, but inside there is a whole system: motor itself, gears, and motor driving and control circuit. The gears reduce motor speed but increase torque. As we mentioned, servos work with a closed feedback loop when the potentiometer is connected to a mechanical shaft and senses the angle of turn. The potentiometer voltage directly indicates the grade of twist. The potentiometer signal goes to a digital controller of the motor, which powers the motor until the potentiometer reaches the desired angle, then the logic circuit shuts the motor.

Continue reading

How to write an LCD menu for AVR in C

Let us write a simple LCD menu for AVR. I am using four buttons: 2 for menu scrolling up and down and two for changing submenu parameters. As the output indicator, I am using three LEDs that flash according to the menu’s parameters. Button states are captured by using timer0 overflow interrupts. The circuit is elementary:  I have excluded the power circuit for simplicity, just left the main parts: LCD, LEDs, and buttons. This circuit works well with the Proteus simulator as it is. The Proteus circuit is attached to the project archive. My idea is to store menu strings in Flash memory without occupying MCU RAM. This way, menu items are limited only by Flash memory, not by RAM.

Continue reading

AVR-GCC 4-bit and 8-bit LCD library

Earlier I have used 4-bit and 8-bit LCD libraries in various projects. It was hard to maintain and update. Now they are merged into one library where the simple logic structure is implemented to select a 4-bit or 8-bit LCD library just by modifying only three code lines. In the library header file there is line added: //Uncomment this is LCD 4 bit interface isused //****************************************** #define LCD_4bit //****************************************** You can select different LCD modes by commenting and uncommenting this line. Also, don’t forget to select proper ports and pins where the LCD is connected:

Continue reading

Getting hands on Arduino Ethernet Shield

Probably everyone knows Arduino and perhaps using it. This development platform is worth its popularity. Probably the best thing about it is open-source ideology. Indeed it is an excellent development platform that includes software and hardware solutions where even non-electronics guru can master great projects. In a few years, Arduino has grown in a great community around the world. And that is great – this means that you have access to endless resources, endless project ideas and lots of members willing to help if you are stuck with something. All the necessary information you can always find in https://www.arduino.cc/. OK, enough of talkies. Let’s see what we have here. Thanks to SparkFun electronics, Arduino Duemilanove stands on my table fully assembled and ready to work. I decided to give a try on Arduino Ethernet shield based on Wiznet W5100 chip. It has a library, so you don’t need to think of details how Ethernet chip is controlled. Few lines and you have some info in your favorite browser.

Continue reading

Temperature sensor with time and date display on graphical LCD

Some time ago, I built a prototyping board with a graphical LCD. It has served for various small projects and prototypes. I had a spare temperature sensor DS18B20 and decided to put on a simple temperature display project. GLCD board is equipped with an Atmega32 microcontroller running at 16MHz. DS18B20 sensor is connected to port D pin 6. LED connected to PD3 is used for indicating EEPROM write activity. The device is navigated with a rotary encoder. It is connected to MCU as follows (more about interfacing rotary encoder here):

Continue reading