In this post we will look at analog to digital conversion or ADC on the PIC32 microcontroller. The data in our world exists in analog format, however computers are digital by nature. What this means is that to allow the microcontroller to interact with our world we must use an Analog to Digital Converter. The ADC has countless uses and in this example we will look at using the ADC module on the PIC32MX270F256D.
The USART module on board the PIC32 microcontroller is a peripheral that has been there since the very early days of computing. The protocol used by the USART module has compatibility with the RS232 communication ports that were previously available on computers. The USART module is one of my favorite peripherals. It is simple to understand and simple to use. In this example we will use the USART module on the PIC32MX270F256D.
In the last post we looked at using the PIC32 microcontroller as a timer. In this post we will look at using the PIC32 as a counter. The only difference is instead of using the PIC32 to count internal pulses, we will count external pulses of a pushbutton.
Continue reading “Starting with 32-bit PIC Microcontrollers Part 5: Counter”
Sometimes it it necessary to allow your microcontroller to use the onboard timer to perform certain tasks. The PIC32 has a timer which can count internal pulses as well as the pulses of external clock sources. Generally when counting internal clock pulses we refer to the Timer module as a “Timer” and when counting external clock pulses we refer to it as a “Counter”. This is no rule set in stone but just a general trend I noticed. We will use the Timer1 module on board the PIC32MX270F256D microcontroller as if you can use Timer1 then it is possible you can use any timer.
Let’s say you are doing something and your phone rings, you would like to answer your phone wont you? So you stop what you are doing and answer you phone. After you are finished talking you return to whatever task it was you were doing. In the same way the PIC32 microcontroller provides a mechanism to allow it to attend to the tasks at hand then return to the normal program execution. This is known as interrupts. In this post we will look at using interrupts with the PIC32 microcontroller.
In the last post we looked at performing output with the PIC32 microcontroller. In this post we will look at using the PIC32MX270F256D microcontroller for the purpose of reading a pushbutton switch.
The PIC32MX270F256D is a powerful microcontroller. Unlike the many ARM variants that require setting up a lot of complex clocks and leaves you totally dependent on the software provided by the manufacturer, the PIC32 is not like this. With the PIC32 is is possible that you will be able to write your own drivers and software with the same level of complexity as using an 8 bit microcontroller.
After getting my STM32 microcontroller to read quaterion data from an MPU 6050 IMU, I decided to do a little demo to test how accurate the input is for things such as 3D control. Looking around for a good 3D framework to work with I decided to use the JavaFX 3D graphics framework because it is very easy to work with and Java is a well known language. In this brief post I present to you the methods of using JavaFX with an IMU that takes readings from the user and uses it to manipulate a 3D shape within JavaFX.
With all this rage about using and programming drones and other robots, the word “IMU” has become to be understood by many persons. An IMU or Inertial Measurement Unit is an important component of robotic systems. The IMU is essentially uses and “fuses” together data from other sensors which is then used to track things such as position, orientation and velocity. In robotic systems and frameworks such as ROS, the data used to measure these things is in the form of quaternion data. Also any device that tracks movement can benefit from using quaternions to determine orientation.
As such a low cost IMU such as the MPU6050 can be used for prototyping and low cost robotics. The MPU6050 is very low cost and readily available from a variety of sources. In this post we look at how we can use the MPU6050 to generate the quaternion data needed for accurate orientation measurement for your robots and devices. Skipping all the complex theory, I will explain what quaternions are and how we can use the MPU6050 to generate quaternion output with the STM32F103C8T6. The principles in this post will apply to any IMU as we only use the MPU 6050 for it’s accelerometer and gyroscope readings and do not use the on board Digital Motion Processing Unit (DMP) calculations.
When you are looking to add wireless communications to your project, you may be bombarded by a variety of sensors and modules. Your options include WiFi, Bluetooth, LoRa among others. However the NRF24L01+ modules are cheap and readily available and can allow communication wirelessly on the Industrial, Scientific and Medical band (ISM) band. This band is good because its unregulated and if you need to add simple wireless control to your project, it may be viable to use this band to communicate. In this post we look at using the modules with the STM32F103C8T6 ARM microcontroller.
PIC32 vs STM32
For years the “Holy War” of microcontroller battles has been PIC and AVR, and whilst the battle in the 8-bit arena is yet to be “officially” decided. I say “officially” because with Microchip acquiring Atmel, I guess we know who the winner is (here’s a hint: it’s Red not Blue).
However, it seems the current trend is toward using 32-bit microcontrollers. Whilst 75% of the tasks we use Microcontrollers for today are handled adequately by 8-bit microcontrollers, it seems “32-bit” has become a buzz word that management likes to throw around. These new Gen-Y and Gen-Z kids also all seem to want to use 32-bit microcontrollers and 8-bit is fast becoming a harder and harder sell. In this post I examine the camps of MIPS vs ARM, PIC32 vs STM32. I will admit to being a PIC fanboy, however I will attempt to be as neutral as possible in my comparison.
Switching Solar Charge Controller
In the last post we looked at a basic overview of solar power systems. We looked at the various components of solar power systems as well as choosing the best components for your own system. One such component we looked at were solar charge controllers. These charge controllers are of many different types including On/Off also formally called switching type controllers, PWM type controllers and MPPT type controllers. In this post we will design the simplest and cheapest type of charge controller, the switching type controller. The design is based around the powerful PIC16F18855 microcontroller.
Solar Charge Controllers
Many persons are interested in setting up solar panels to power their homes and businesses. However most persons aren’t aware of the aspects of how to set up a small off-grid solar system. In this post I take you through the basics of setting up a small off-grid solar system in your home or small business. After giving a brief introduction to the process of setting up a solar system to supplement of replace your dependency on energy from the grid, I will give you a basic overview of the many type of solar charge controllers available on the market today, and throughout the next three series of posts we cover each type of charge controller.
ARM microcontrollers are the future. Despite the claims that 32 bit will surpass 8 bit over the years, we have finally reached the point where for certain projects it may actually be more economical to use 32 bit devices. We have seen a drastic decrease in the price of 32 bit microcontrollers, and the STM32F030F4P6 is one of the cheapest 32 bit microcontrollers today, coming in at under a dollar on Digikey in quantities of 100 or more. This was so revolutionary, I decided to buy 500 of these pieces of silicon and take them out for a spin. Though some 8 bit controllers like PIC or AVR have a lot of Core Independent Peripherals that simplify design, for 80% of what I used microcontrollers for it is not needed. In this quick-start post we explore this tiny and powerful microcontroller.
Despite the advent of touchscreens in embedded systems today, sometimes there are applications where an LCD can be used depending on your design. Upon searching for a working LCD module with the STM32F103C8T6 microcontroller and MikroC for ARM, I was unable to find one that was easy to use and understand. So I modified the one that was provided by Adafruit and made it very simple to interface with.
The code can be downloaded from Mikroelektronica LibStock here: