Once again I am playing around with PIC microcontrollers. Now I finished a complete demo that does this:
- drive a 4-wire fan, in my case a Noctua NF-S12A using PWM
- read the fan’s tachometer output to determine its speed
- show the PWM duty cycle and fan speed on a 16×2 LCD
The demo application starts with a duty cycle of 0, where the fan doesn’t rotate and increases the duty cycle by 5% every 5 seconds, until it reaches 95%. Then it decreases the duty cycle by 5% every 5 seconds until it reaches 0. It keeps repeating this sequence forever.
At the same time it counts the pulses coming in from the fan’s tachometer output and displays the calculated speed every second.
The circuit on my breadboard is made after this schematic (click to make it bigger):
The circuit to drive the fan and to read the tachometer is really simple. The microcontroller runs at 5 Volt and can directly drive the PWM input from a CCP output. The signal from the tachometer needs to be pulled up to 12V, after which simple resistor divider suffices to get that signal at the required TTL levels.
The application is written in MPLAB X and uses Microchip’s xc8 compiler. The LCD module is borrowed and adapted from the “PC Case USB LCD” project by Simon Inns. The source is heavily commented so should be quite easy to understand.
You can see that the fan starts spinning when the system is powered up, but that it doesn’t move at duty cycles of 0 and 5%. It does start spinning at 10%.
I sincerely hope that this helps someone.
For about half a year now I own a Synology DiskStation DS412+, which is a wonderful 4-bay NAS. I fitted it with 4 3TB Seagate drives for a grand total of 12 TB of storage. Later I will document how I store my data and especially what and how I backup.
Now I want to note the steps I have to take after updating the DSM software of the box to get things back to normal. Because the same two things always break:
- Lost access to ipkg packages
- Password authentication gets re-enabled for SSH access
After setting up the bare VPS, it is time to gain secure access to our Ubuntu Server running on the VPS through a secure shell connection (SSH).
From the standard RFC 4252 that defines SSH:
The Secure Shell Protocol (SSH) is a protocol for secure remote login and other
secure network services over an insecure network.
Of course, the insecure network here is the internet.
We will setup SSH access in two phases:
- Setup basic SSH with the normal login credentials
- Secure access further with a key
Here is the documentation of my next step: driving the LED display. The design and the C code were not really difficult; the steps to put the results here were.
As I noted before I use a PIC 16F887, but CadSoft Eagle didn’t have this component in its library, so I drew a 877 which is pin compatible. Now I wanted to get it right and so I started my own library. Copying the 877 to it and then renaming it to 887 was simple enough. The next step was to get my 4 digit 7 segment display (datasheet in PDF) in Eagle. I did find a 3 segment display that came close and it took me a bit of time to add the fourth digit. Now my custom library contains two components!