Show by Label

Thursday, December 17, 2015

_HowTo: Rotary Encoders & Raspberry Pi

After having found a simple and reliable solution for a rotary encoder using a PicAXE (see demistifying rotary encoders), I figured that I could easily port that solution to my Pi's.

Well, no! The Pi is so much faster that the solution did not port or translate, see this post for Details on how I developed one for the Pi. https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=126753&p=848012#p848012

Enjoy!

If you like what you see, please support me by buying me a coffee: https://www.buymeacoffee.com/M9ouLVXBdw

_HowTo: Demistifying Rotary Encoders

For a new project, I needed a way to reduce parts and complexity, so it was time to finally bite the bullit and start working on a microcontroller. My experience with embedded controllers dates back at least 35 years, which is why I had been putting the decision off for a long time. Things changed in that period, and I was not keen to dive in yet. After investigating the available solutions, I decided on the PicAXE family due to the very complete design environment, and the availability of a programming language other than C or C++.

The new project needed a large selection method for frequencies and voltages, and traditional rotary switches became expensive and complex. So I decided to use a rotary encoder together with an embedded controller. It also solved the problem of a complicated frontpanel, because I now could use a display driven by the controller.

While researching rotary encoders, I learned a lot about decoding them, and eventually decided on a method that is adequate for my application.

I wrote two posts on the PicAXE forum to explain this in more details, and here is the link: http://www.picaxeforum.co.uk/showthread.php?28222-Demystifying-Rotary-Encoders-(one-more-time)-Part-1-2

Enjoy!

If you like what you see, please support me by buying me a coffee: https://www.buymeacoffee.com/M9ouLVXBdw

Monday, December 14, 2015

_HowTo: Using a single push-button to start/stop/powerdown the Raspberry Pi

A while back I did some work by another forum member to incorporate an interesting chip with Raspberry Pi's. It really lacks a "PC" like start/stop button, but this was left out most likely for cost reasons. There have been many designs made to solve this challenge.

Linear came up with a couple of chips that helps to solve this problem, and with the help of the Raspberry Pi foundation, an overlay was created to get a GPIO port that can signal the end of the Halt status.

Based on that work, I created a design that is well documented and rather easy to build. While I was at it, I came up with a couple more designs that uses this chip, the LTC2951-1, although there are several in this family. Unfortunately, these chips are hard to get, not in-expensive at about $5 each, and come in a tiny, very tiny SMD package. On top of that, MOSFET's are used to switch the power, and the right ones (with a low RDS-on) are also only available in SMD packages.

Eventually, I was able to come-up with yet another design that is even more simple, and only uses 4 resistors and 1 capacitor, in addition to a push-button.

Here is the link to the posts on the Raspberry Pi forum:
https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=128019

Enjoy!

If you like what you see, please support me by buying me a coffee: https://www.buymeacoffee.com/M9ouLVXBdw

Monday, October 26, 2015

_HowTo: Adding an Analog Output to the Pi (DAC)

Here is a post I wrote on the Raspberry Pi forum about adding an analog output to the Pi by using a DAC.

Here is that link : https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=124184

Enjoy!

If you like what you see, please support me by buying me a coffee: https://www.buymeacoffee.com/M9ouLVXBdw


_HowTo: Adding an Analog Output to the Pi (PWM)

Here is a post that I put on the Raspberry Pi forum about using the Pulse Width Modulation feature to create a (static) output voltage. The result is more accurate than most would expect.

Here is that post : https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=124130

Enjoy!

If you like what you see, please support me by buying me a coffee: https://www.buymeacoffee.com/M9ouLVXBdw

_HowTo: Adding an Analog Input to the Pi (ADC)

I wrote a post on the Raspberry Pi forums about adding an analog input to the Pi by using an ADC. The application I used to describe it was to measure the 5V supply to the Pi, which is still a major source of problems and confusion.

Here is the post : https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=123962

Enjoy!

If you like what you see, please support me by buying me a coffee: https://www.buymeacoffee.com/M9ouLVXBdw


Tuesday, August 11, 2015

_HowTo: Controlling a temperature driven Fan with PWM

Because I need a fan for my power supply project, I started a little project to do that.
I don't like noise or hum, so I wanted to use a fan that would be off when not needed.

Typically, by using Pulse Width Modulation (PWM), rather than a voltage, you can precisely control the speed of the fan, and ramp it up when needed.

I was able to find some clever methods to implement this, and pieced together this design:

The building blocks are relatively simple. I use a DC-DC convertor, not a linear one, to bring the 24V DC to 5V, because a linear LM7805 would get too warm burning off the excess voltage.
I use a comparator with hysteresis to determine the starting point of the fan, based on the temperature reading (in ohms) of a thermistor that is mounted on the heat sink. I don't have the datasheet for the thermistor, but found that it gets from 10K at room temperature to about 5K when the heat sink is getting really hot.

I need 5V for the fan, because I have one that is only 10mm thick, and that is what I have room for.

The clever trick of this circuit lies in the fact that the Control Voltage (CV) input from a 555 timer is used to control the PWM.

The 555 is producing pulses, and the pulse width, and also a bit of the frequency is varied by applying a voltage to the CV input. The output of the 555 goes to a FET that drives the fan.

The whole thing works very well, although the low pulse frequency can be heard from the fan, so I needed to use C4 and C5 to remove that chirping sound.

There are two disadvantages of this design.
One is that you cannot regulate the full 100% of the pulse width. The minimum is OK at about 30%, it let's the fan spin very slowly, but the maximum is only about 70%.
The other disadvantage is that you cannot increase the frequency of the pulses above the hearing frequency of 20KHz, because then the effect of the thermistor on the PWM range is greatly reduced. 

In my application, that is not good enough, I need to be able to get to the maximum fan speed in order to keep things cool.

There are special fan/motor controllers that allow you to do that, so I have a couple of TC648VPA chips on order. Stay tuned.

The chips arrived and I made two different circuits. One for a 12V DC Fan I also ordered, and one for the 5V DC fan.  I used an Excel spreadsheet that is available on the MicroChip website to calculate the resistors (R1 and R2) to get the best starting and maximum fan speeds.




The TC648 works really well, and is a nice addition to my toolbox. Next step is to put the circuits on vero board and install them in the power supplies.

After playing and experimenting, I decided to make a few changes to the circuit. First, I implemented the VAS  pin. The explanation says to set the Auto-shutdown threshold with this pin, but it also sets the turn-on threshold. The nice thing is that the fan will be driven to full speed for a short period, making sure it turns on right away. This was a problem I noticed with the earlier circuit.

Second, I deleted the resistor that was in parallel to the NTC. I felt that with a 10K NTC, it didn't do much. I also experimented with C7, which sets the frequency to see if I could remove the audible noises at lower speeds. That only worked with a 10nF cap, but then the PWM spread is limited and therefore also the speed control. So I resorted to using the 1uF value.

BTW, after a lengthy search, I found the information about the NTC I was using, because I wanted to know the temperature curves. Unfortunately, the shop I got them from didn't mention the type or manufacturer. I have the TDK B57045K0103K000.

I also found a much more elaborate data sheet for the device here: http://ww1.microchip.com/downloads/en/DeviceDoc/21755c.pdf

And here is the latest version of the schematic:


If you like what you see, please support me by buying me a coffee: https://www.buymeacoffee.com/M9ouLVXBdw