Figure 1. IO Expansion board attached to the RPi
When the Raspberry Pi was first released, I felt that the on-board I/O capabilities were not adequate for my needs. So I decided to build my own I/O expansion board. I decided to include:
- MCP23017 that adds two 8-pin general purpose input/output (GPIO) ports,
- PCA9685 that adds 16 12-bit pulse width modulation (PWM) channels with variable PWM Frequency (20-1000Hz), and
- MCP3008 that adds an 8-channel 200Ksps analog to digital converter (ADC).
The first two are attached to the I2C bus while the last is attached to the SPI bus. I designed the board layout using the Eagle PCB layout tool in the Fall of 2012. I even ordered some bare PCBs at the time, but I didn’t have the time /equipment to populate the board. So I put it on the back burner and conveniently forgot about it. The emergence of many other I/O expansion boards such as the awesome Gertboard and Piface further reduced my incentive to continue with this project.
Recently however I decided to revive this project…..at the very least as a PCB layout design & soldering exercise. So I dug out the PCBs & populated them with the necessary parts and did some pre-eliminary testing. So far everything seems to be functional (all power connections are fine, the “i2cdetect” also detects the device addresses of all i2c devices) but I’ve yet to run any major programs on it. I will be posting updates on this in the next couple of weeks. I will also post code examples for interfacing the PCA9685 chip with the Raspberry Pi.
Figure 2. Populated I/O expansion board for the Raspberry Pi ver 0
One of my main objectives for this I/O expansion board was to make it as low cost as possible to manufacture…..perhaps under $15 if mass produced. The three chips chosen cost about $1-2 each in unit quantities and are sure to cost significantly less in larger quantities. Continue reading
Recently, ST Microelectronics released 32-LQFP versions of their STM32F0 microcontrollers. The great thing about 32-LQFP packages is that the spacing (pitch) between the pins is 0.8mm. This spacing is rather forgiving for surface mount soldering noobs like myself and with some experience is very straightforward to deal with.
So I decided to give soldering these parts a go, and bought a few stm32f051k8t6 microcontrollers from Digi-key. I also bought some 32LQFP to DIP adapters from DAQSTUFF. I then proceeded to solder the microcontrollers on the adapters. As I expected, it was not easy, but not impossible. After soldering the part on the board, I checked for solder joints between the pins using an eye loupe as well as a continuity tester. The soldering job is not the greatest but is not bad considering that its my first attempt at it. Once all the solder joints were eradicated, I had two STM32F0 micros soldered on tiny boards & ready for a software trial run!
Figure 1. Photo of the soldered micros on the adapter boards after inspection
I followed the steps on my newer STM32F0Discovery board tutorial series, and everything just worked! The only modification that I had to make was to change the LED pins in the main.c file from PC8 & PC9 to PB0 & PB1, as there is no GPIOC port on this low pin count package of the STM32F0 micro.
In this blog entry we will examine using a development environment based on command line tools which will include using the VIM (VImproved) text editor, the GDBTUI debugger along with the Texane’s stlink and OpenOCD GDBserver / programmer utilities. It is assumed that the reader has completed Part 1 of the tutorial.
So why use these tools when you have sophisticated tools such as Eclipse ? Command line tools run faster, are usually less buggy than their GUI counterparts and require significantly less memory and processing power. They also allow for a high degree of automation. They can turn your old PC into a development power house! Continue reading
This is the first part of a 2-part tutorial on setting up and using a free and fully functional development environment with the STM32F0Discovery board on a Linux PC . The official ARM (GNU Tools for ARM Embedded Processors) GCC toolchain and the openOCD and Texane’s stlink debugger / programmer utilities will be used within a command line based environment. Two example projects will be utilized; one that’s based on the STM32F0′s standard peripheral library and one that isn’t.
Why the ARM Cortex-M0 & why the STM32F0 Family Specifically?
The ARM Cortex-M0 is a 32-bit core that strikes an excellent balance between performance, power usage and price. It may not be as sophisticated and powerful as its older siblings the ARM Cortex-M3 & M4, but its simplicity, ease of use, lower cost and reduced power consumption easily makes up for that. The ARM Cortex-M0 core was designed to compete with other 8-bit/16-bit microcontroller cores and it succeeds in this goal on all major fronts; performance,low power, price and time to market.
In this entry I will demonstrate how to interface the MCP3008; an SPI-based analog to digital converter (ADC) integrated chip; to the Raspberry Pi. This enables the the Raspberry Pi to interpret analog voltages that are in turn typically emitted by analog-based sensors to reflect a measure of a physical characteristic such as acceleration, light intensity or temperature. We will start by briefly examining the SPI interface.
Figure 1. 3 SPI slave devices connected to a single SPI master device. In this case a total of 3+n – > 3+3= 6 wires are required. Image acquired from here