orange pi is an awesome sbc manufacturer known for excellent hardware and awful software support.
I’m a very happy owner of the first generation orangepi zero witch I use as a headless Linux server on my network.
Today orangepi release a new version of the orange pi zero called the “orange pi zero 2 plus” the cpu goes from the H2+ to the H3, the wlan controller is better, you get a csi camera interface. And 8gb onboard mmc flash.
Also the board gain an hdmi port witch enable easy video output to a screen or a TV.
The board also gain bluetooth support if that something that’s useful to you.
Overall its seems the addition of the hdmi port is at the expense of the disappearance of the ethernet port witch was for me one of the best feature of the first edition of the orange pi zero.
The board is made for a different purpose, the 2 plus is going to be ideal for a very small media player or a emulator gaming device. Since the video output and the 4k capability are adding this kind of possibilities
The board is also much more expensive than its predecessor at 18$90 compared to the original 512MB orange pi zero at 8$99.
Since I don’t require a video output the original orangepi zero suits better my purpose, but for most people a video output is mandatory,
The orange pi zero 2 plus is going to be be an excellent board once the armbian team release an image for it.
After installing my orange pi zero. I tried to use my board the reencode some video file that use xvid/ac3 to x264/aac with the ffmpeg linux command.
The problem was that it took more than two hours at 100% cpu usage on the 4 cores to reencode the video, during that time the cpu was getting instantly too hot and, as a result, was heavily throttling . I tried to use a radiator, and it significantly reduced the amount of throttling but it was not eliminating it, since eventually the cpu reached pretty high temperature.
I decided to add a fan to blow on the radiator to reduce even further the cpu temperature.
I didn’t want the fan to be running all the time so I decided to use the gpio function of my board to control the state of a pin to start and stop a fan.
The problem is that the logic levels sent by the gpio is 3.3v which is much to low to start the fan i own.
My fan is a 12v fan, but it turns out that it can run at 5v, it just have a lot of trouble starting, most of the time when I put 5 v on the fan, I just see a very small movement, and then nothing, I just have to give a little push, and then it will start
Of course, this is not going to be OK. I must find a way to start that fan without that initial push.
To send 5v instead of 3.3v to the fan I used a PNP transistor that will be controlled by the 3.3v signal.
As you can see on the photo, the pin one of the PNP transistor is wired to a GPIO pin, the pin 2 is wired to the pin 2 of the board which provide constant 5v,and then the pin 3 is wired to the the red wire of the fan.
The black fan wire is connected to the pin number 6 of the board.
Here is a little schematic of the wiring.
To control the gpio I used wiringpiprogram that I found at this URL
At first I tried to use the gpio pin number 23 but, for some reason I failed to change the state of that pin using the wiring pi library.
I then chosed to use the pin number 7 which is named GPIO.7 in the “gpio readall” command.
First I configured the pin 7 as an output using that command
gpio mode 7 out
Then i use that command to set pin 7 at logic level 1 (3.3v)
gpio write 7 1
But even with all that, my fan still needed a little push to start turning.
After a good afternoon where I considered buying a cheap and small 5v fan on one of the classic Chinese website, i remarked that if my control GPIO pin was not soldered and I disconnected and reconnected very rapidly the control wire, the fan was starting every time.
The idea of a bash script exploiting this fact was born.
Here is the script that works for me every time!
gpio mode 7 out
while (($i < 10))
gpio write 7 1
gpio write 7 0
gpio write 7 1
This script put the pin 7 in output mode, then switch the state of pin 7 rapidly provoking the startup of the fan. At the end of the script the pin 7 is left in the 1 state.
To be sure the fan started, I usually launch this script 3 times, but it’s overkill and one time is enough most of the time.
When I want to stop the fan, I just launch the command
gpio write 7 0
And the fan stop immediately,
Now creating a script that launch automatically the fan when the cpu get above a predefined temperature is going to be extremely easy, I will describe it in another article.
Even if the fan is turning very very slowly , it does have a very significant effect on cpu temperature
If you have a influxdb server running , there is some data collector like Collectd that can be used to automatically write data in your database.
But collectd is very difficult to personalise. and the documentation is pretty bad, (try using the curl plugin and greping data)
You can’t easily add the result of a piped bash command to the collected data for example.
in my case i’ve decided to ignore these pre made solutions that never completely satisfy my needs or write exactly the value i want in the database,
there is a simple way to use a http request to write in the influxDB database.
first before you even write something in ingluxDB, you have to create a database (you only have to launch this command once)
there is high chance that the version of grafana package in the repositories of your distribution is outdated
in my case , i use armbian , the repo is from ubuntu xenial .
the version of Grafana in the xenial repo is antique (grafana 2.6.0) and the version is bugged if you use a Headless version of the os ,
the icon are not displayed when you are connected to the grafana interface. (because of a bug in phantomJS).
if you have already the 2.6.0 runing , remove it first
apt-get remove grafana
Then use this page to download a recent version of grafana compiled to run on a arm cpu
dpkg -i grafana_4.1.1-1484347088_armhf.deb
if the grafana service is not auto starting at the system boot , you can launch that command :
systemctl enable grafana-server.service
you can check with netstat that your grafana service is running if your server is listening on the tcp port 3000
netstat -tcp -l
now start your browser and try to connect to http://ip-of-your-server:3000