Buying the Odroid N2 fan

Post Reply
Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Buying the Odroid N2 fan

Post by Moan »

Hi. Although I don't need it, I want to buy a mini-fan for my Odroid N2 (non + version), using some cheap method.
I don't really care about the compatibility with the heatsink, as it looks like the official fan is also not compatible: https://www.hardkernel.com/shop/80x80x1 ... connector/

My question is, what parameters I need to consider when buying the fan? Is there some power limit that I should consider?
For example, would this one (5V 2PIN Sleeve version) be compatible even though it's 0.4A, while the default one is around 0.18 A?

User avatar
odroid
Site Admin
Posts: 42659
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3758 times
Been thanked: 2123 times
Contact:

Re: Buying the Odroid N2 fan

Post by odroid »

The fan driver transistor on the board can handle up to 0.5A probably.
But the fan in your link RPM value seems to be too high. Try finding a slower one like 1800 RPM or less to lower the power consumption as well as wind-noise.

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

odroid wrote:
Wed Jun 26, 2024 10:21 am
The fan driver transistor on the board can handle up to 0.5A probably.
But the fan in your link RPM value seems to be too high. Try finding a slower one like 1800 RPM or less to lower the power consumption as well as wind-noise.
Thank you for your reply.

I found a nice-looking fan here.

Screenshot 2024-06-26 151040.png
Screenshot 2024-06-26 151040.png (390.46 KiB) Viewed 426 times

Unfortunately, it has 2PIN-XH2.54 connector instead of the required 1.25mm. Do you think this could be workaround with jumping wires?

User avatar
odroid
Site Admin
Posts: 42659
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3758 times
Been thanked: 2123 times
Contact:

Re: Buying the Odroid N2 fan

Post by odroid »

I don't think there are 1.25mm pitch connector compatible jumper(Dupond) wires.

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

I don't think that Aliexpress fans are worth the wait and that modest saving.

You may have to solder your own 1.25mm pitch pigtail because finding such a fan will be very hard.

Alternatively, you could just connect it to 12V power supply and give up PWM regulation, if the fan will be of high quality and powered off a lowered voltage it may be acceptable.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

mctom wrote:
Thu Jun 27, 2024 5:56 pm
I don't think that Aliexpress fans are worth the wait and that modest saving.
The waiting is almost always 1-2 weeks, so it's not a big deal. This fan was actually higher standards than the cheap ones they have :)

I think I was overreacting. I'm getting ~60-65 C (max) on high load, and I thought its high, but thinking about it now, for passive cooling it's actually cold. Computers are working with the same temperature while being actively cooled.

For now I changed my N2's placement (so it's on a metal phone holder) and it already decreased some temperatures. I'm recently running N2 on 100% load (generating a preview images with thumbnails of all old Camera recordings), that's why I was a bit worried about temperatures.

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

Yes I remember I regretted buying an official fan for N2+ because it never turned on in my room temperature. :D
It's a colder place than Korea..
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

mctom wrote:
Fri Jun 28, 2024 4:03 pm
Yes I remember I regretted buying an official fan for N2+ because it never turned on in my room temperature. :D
It's a colder place than Korea..
You can set different temp zones so that it would activate e.g. at 50 C.

I ordered something and something now. It will probably be hard to connect without the adapter, but maybe I'll figure something out. I was almost reaching 70 C today (at 100% CPU usage), and the hot weather makes it harder. The external fan that I use is too loud and it's annoying at nights :)
Screenshot 2024-06-29 002642.png
Screenshot 2024-06-29 002642.png (62.61 KiB) Viewed 374 times

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

Yeah that's what I did, I activated the fan at lower temperature.

When XU4 was my home server (before fanless M1 came around) I created a service that changed cooling policy depending on the time of day.
During the day, the fan was doing the job as usual (it mostly spun up when the server was receiving a daily backup).
At night, the policy was to limit the maximum fan PWM to some inaudible speed and throttle CPU instead.

Perhaps you could do something similar?
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

mctom wrote:
Sat Jun 29, 2024 4:59 pm
Yeah that's what I did, I activated the fan at lower temperature.

When XU4 was my home server (before fanless M1 came around) I created a service that changed cooling policy depending on the time of day.
During the day, the fan was doing the job as usual (it mostly spun up when the server was receiving a daily backup).
At night, the policy was to limit the maximum fan PWM to some inaudible speed and throttle CPU instead.

Perhaps you could do something similar?
Funny story, I also had XU4 for some months and played a lot with custom fan policy. What was annoying me was that it was activating periodically for less than 1 second or something. I made a script that was enabling the fan until temperature went below the expected one. I ended up buying N2, because the fan was actually annoying me at nights :D Even though it was not that loud.

I often sleep dynamically, so the time of day based rules would be bad for me. I remember trying to set the vacuum cleaner robot schedule and it was very annoying.

I am also angry at myself for trying to to use N2 too much. Today I ran my thumbnails generator script on a desktop PC with Ryzen 9 5950X, and the entire process was so much faster. I could simply use my PC better sometimes (not just for gaming) and let Odroid be a low-power device...

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

I remember that PWM setting for XU4 to make it inaudible (at least for me) was really low, something like 80/255. ;)

If you wanted a silent board, M1 would have been a better choice. I run it 24/7 with CPU constantly at 100% (BOINC tasks use spare CPU time), and without a fan.

I don't own anything more powerful than Odroid H3+, because I don't run any urgent CPU intensive tasks. Sometimes I make my M1 transcode a video and I don't mind it taking a week or two. ;)

I don't remember if you ever mentioned what your N2 was supposed to be doing in the first place, but perhaps throttling is all you need after all.
You could mount it vertically to promote convective ventilation. I have found a little test I did with M1: viewtopic.php?p=346926#p346926
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

I'm so stupid.

I got these fans today, but I don't have Molex 51021-0200. Since I'm impatient, I decided to solder it. At first it looked good, but when I booted Odroid the fan wasn't working, even with commands:

Code: Select all

echo 1 | sudo tee /sys/class/hwmon/hwmon2/pwm1_enable
echo 20000 > /sys/devices/virtual/thermal/thermal_zone0/trip_point_4_temp
20240702_181333.jpg
20240702_181333.jpg (454.65 KiB) Viewed 321 times
20240702_181731.jpg
20240702_181731.jpg (493.27 KiB) Viewed 321 times
20240702_184406.jpg
20240702_184406.jpg (558.76 KiB) Viewed 321 times

Then I touched Odroid's heatsink, and I felt a small electric shock. So I powered it off immediately and dismounted that fan. But at the same time I connected these two pins with the solder metal. I panicked and didn't know how to disconnect it / clean it up. At the end I managed to do it, but I am still scared that there's some connection... Hopefully there isn't.

What bad could happen if the Fan power and ground got connected together? Hopefully nothing too serious. Maybe just in case I should somehow disable the fan fully.

It didn't look too terrible at the end, but I will probably not be able to connect molex to it once I buy it :(
20240702_200453.jpg
20240702_200453.jpg (460.97 KiB) Viewed 321 times
20240702_200939.jpg
20240702_200939.jpg (645.52 KiB) Viewed 321 times

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

If there is a short between two fan pins, the worst that could happen is nearby Q5 burning. But that's an inexpensive component, the problem is to replace it.

Yeah this connector probably won't be usable, but fortunately that shouldn't impact the rest of the computer.

The red wire of a fan should be connected to any point that has 5V. If you want we could find a place with 5V that is easier to solder to.

The black wire is supposed to be connected to the lonely pin of the 3-pin Q5 transistor. It might be easier to solder a wire to it.
Start with adding more tin to that pin. Then, heat it up again and slide a wire into this tin blob, and take away the soldering iron, while still holding a cable in place, until the tin sets.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

i found a "State Relay" thing that I bought some time ago but never really used.

Then I connected the new fan to USB male plug. Then I made some cabling, so that the relay decides to enable the fan, and I can control it with:

Code: Select all

echo out > /sys/class/gpio/gpio2024/direction
# or:
gpio mode 26 out
sleep 1
gpio write 26 0
or

Code: Select all

echo in > /sys/class/gpio/gpio2024/direction
# or:
gpio mode 26 in
sleep 1
gpio write 26 1

I have bash script that decides which hours to use it, what CPU temperature (or desk temperature sensor temperature) to enable it, and when to turn it off.

The obvious issue is that the fan works with the maximum speed, but it's not a very loud fan for 2440 RPM. It would still be better to be able to use the dedicated fan slot :(

Maybe I should order the Molex 51021-0200 plug anyway? Maybe there's a hope that with some praying it will fit the slot after my surgery? :)
Attachments
20240703_011020.jpg
20240703_011020.jpg (520.94 KiB) Viewed 308 times

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

That's a Solid State Relay, as opposed to mechanical relay with moving parts. It's basically a transistor embedded with its driving circuit.

You can decrease maximum fan speed by adding a resistor in series. Something in order of 10R - 330R.

The connector surely is possible to replace, but I would rather recommend you finding someone who will do it...
There is a risk of ripping PCB traces off if done improperly.

You may find my gpio fan controller suitable for your setup.
https://github.com/tomek-szczesny/gpio-fan-controller

It generates PWM for driving a fan on any GPIO.
I don't know how fast are solid state relays, so you may want to configure lower PWM frequency, such as 20Hz.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

mctom wrote:
Wed Jul 03, 2024 6:14 pm
That's a Solid State Relay, as opposed to mechanical relay with moving parts. It's basically a transistor embedded with its driving circuit.

You can decrease maximum fan speed by adding a resistor in series. Something in order of 10R - 330R.

The connector surely is possible to replace, but I would rather recommend you finding someone who will do it...
There is a risk of ripping PCB traces off if done improperly.

You may find my gpio fan controller suitable for your setup.
https://github.com/tomek-szczesny/gpio-fan-controller

It generates PWM for driving a fan on any GPIO.
I don't know how fast are solid state relays, so you may want to configure lower PWM frequency, such as 20Hz.
Thanks! I'm quite unsure how is this supposed to work? I would need to have some resistors?

My Solid State Relay is powered from:
5V, GND and gpio2024 on Odroid N2.

Then, on the other side (right):
5V power from the charger (or Odroid USB port when I want) is connected to the "A1" in Relay. 5V power that goes to the fan is connected to "A2". The GND from the charger and to the fan are always connected together (without relay).

So I'm not quite sure how would your program reduce the fan speed? I thought it's a simple On/Off Relay.

Also what would be the chipname and gpio_line if I use: "echo out > /sys/class/gpio/gpio2024/direction"
The chipname I suppose would be "gpio2024", but gpio_line I don't know.

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

You don't need to change anything in the physical setup.

Tell me more about this solid state relay (brand, model), and I'll check if it's going to work with PWM.

If you're not sure how PWM works, see here:
https://www.tomshardware.com/reviews/gl ... ,5888.html
It's a crappy explanation but at least shows how digital signal can modify fan speed.
This is in essence switch toggling at a fast rate, which works well with motors with relatively high inertia.

github readme says:
You can use 'sudo gpioinfo' to find the correct gpiochip and line numbers.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

Thank you for all your help.

I have got the ones that look exactly like these: https://aliexpress.com/item/1005004908428159.html
One is 2 channel, and second maybe 5-6 channel version.

The other one is single channel that looks exactly like this one: https://www.walmart.com/ip/Nuolin-ABS-5 ... /258496973

I am using the 2-channel one as it has clearer pins descriptions than the single channel one, so I knew where to connect.


I asked GPT, and it said that these devices might wear out when used as PWM. Can this be true?

GPT.png
GPT.png (80.1 KiB) Viewed 268 times

I now use GPIOX19_PWM_B PIN 36, so I suppose this would be:

Code: Select all

line  84:     "PIN_36"      "sysfs"   input  active-high [used]

EDIT:

Interesting. The program seems to work, but whenever pwm_data is 0, the fan starts with full speed. Tested with:

Code: Select all

std::cout << "pwm_data: " << pwm_data << std::endl;
Otherwise, if I set a very low temperature, such as 10 C, the pwm_data always remains 1, but the fan is working with a very slow speed. Hmm...


EDIT 2:

OK, so I had to modify it a little to notice changes:

Code: Select all

const char *chipname = "gpiochip0";
const int gpio_line = 84;
const float freq = 20;
const float target = 26;
const float min_d = 0;
const float d_step = 0.005;
and:

Code: Select all

    while (!pwm_closing) {
        if (pwm_data_mutex.try_lock()) {
            local_pwm_data = pwm_data;
            pwm_data_mutex.unlock();
            on_time = local_pwm_data * period;
        }
		
	if (on_time == period) {
      	  //Simply enable the fan and don't switch off to save cycles.
	  gpiod_line_set_value(fan, 0);
	  usleep(on_time);
	}
        else if (on_time > 0) {
            gpiod_line_set_value(fan, 0);
            usleep(on_time);
            gpiod_line_set_value(fan, 1);
            usleep(period - on_time);
        } else {
            // Ensure fan is off when on_time is 0
            gpiod_line_set_value(fan, 1);
            usleep(period);
        }
    }
 
and:

Code: Select all

	//float d = 1;
	float d = 0;
	float pwm_data_tmp = 1;

	while (!main_closing) {
		usleep(100000);
		current = fetchTemp();

		if (current < target)  d -= d_step;
		if (current > target)  d += d_step;

		if (d > 1) d = 1;
		if (d < 0) d = 0;
		
		pwm_data_tmp = (d == 0) ? 0 : (1 - min_d) * d + min_d;
		if(pwm_data_tmp != pwm_data){
			pwm_data_mutex.lock();
			pwm_data = pwm_data_tmp;
			pwm_data_mutex.unlock();
		}
		std::cout << "current: " << current << ". d: " << d << ". pwm_data: " << pwm_data << std::endl;
	}
It looks like it's the other way around for me. "gpiod_line_set_value(fan, 1);" disables the fan, while "gpiod_line_set_value(fan, 0);" enables the fan.

The default "d_step" frequency doesn't make much sense, because it almost instantly changes from the full speed fan to 0 speed.

I think the idea of this program is good, but whenever the temperature is over (default) 45 degrees, it will start spinning with the full speed in some seconds. I think it would be nice to have the fan speed scaling with temperature, using some curve. At the moment this program is kind of switch on/off for 45 degrees.


EDIT:

OK, I made some changes: https://pastebin.com/raw/18ZVYAjW

I added the "UseLookupTable" bool, where (for now) I defined:

Code: Select all

std::vector<TempFanSpeed> temp_fan_speeds = {
    {40.0, 44.0, 0.05, 0.2},
    {44.0, 46.0, 0.2, 0.3},
    {46.0, 50.0, 0.3, 0.5},
    {50.0, 55.0, 0.5, 1.0},
};
I also added:

Code: Select all

const int DisableFanValue = 1;
const int EnableFanValue = 0;
To fix my problem where 1 is for disabling, and 0 for enabling.

The code is a bit longer and uses more math, but with that long usleep(100000); it really shouldn't have any performance impact.

It still considers "min_d", and rounds to "d_step". It also still uses the "d" steps so it doesn't instantly change to higher / lower fan speeds. Besides the lookup table it works the same way as before.

Maybe if you like it, you could review it, name variables better and import it to your project?

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

Yeah, the PWM logic might be reversed because the program is designed to work with transistor switches, like the original circuit in N2 for example.

This algorithm is purposefully written like that. Target temperature is meant to be a hard cap. This regulator will do everything it can to not exceed 45 C.
At certain loads it may stabilize with slower RPM and at 45 C, that's the theory. Sure, config values are here to be tweaked.
Truth is I wrote this regulator in the past for some other forum user and never used it myself, so values might need some tweaking.

Regulators with PWM proportional to the temperature are widespread and many people got used to the idea that's how they are supposed to work.
When working in PA industry, 4x160W audio amps in 2U rack module liked to overheat and shut themselves down. The problem was the fan regulator exactly like you want.
I implemented a fan regulator resembling PID controller and all the problems were gone - fan turned on BEFORE the amp reached concerning temperatures, thanks to predictive properties of PID.

But feel free to adjust the code to your needs, enjoy.

Still waiting for the day when ChatGPT responds to EE quiestion correctly, lol
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

I think the code adjusted by me with the lookup table works great. I ran the same thumbnails generation job (90-100% load), and N2 was under 50 °C while the fan only running at 0.2 to 0.4 speed. Of course the room temperature was colder than the last week, but I still think even a little air flow makes a huge difference. The fan I bought with the "ball" seems to be pretty quiet, even at max speed, and at lower speeds practically unhearable.

The only thing I'm worried about is if this won't damage my powered USB hub? I mean, there are tiny periodical electricity jumps. Maybe over time it might have a negative impact on the power supply? Maybe I should set the frequency to match something that is commonly used for 240V electricity? Or it shouldn't matter at all?

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

I'm glad you're satisfied with your fan and that my example code proved somewhat helpful.
I didn't answer you before, but I won't include your customization in my code, because I plan to use it in its current shape in one future project. However I'd be pleased if you forked it and committed your changes on your own github account.

Fans and other motors draw the most current during spin-up (just like HDDs). If your USB port survived so far then I guess nothing bad will happen to it. However if you want to be sure, use 5V from GPIO pin instead. This is the same 5V that drives a fan in the original design.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

mctom wrote:
Fri Jul 05, 2024 12:09 am
Fans and other motors draw the most current during spin-up (just like HDDs). If your USB port survived so far then I guess nothing bad will happen to it. However if you want to be sure, use 5V from GPIO pin instead. This is the same 5V that drives a fan in the original design.
Interesting, I thought that the 5V on GPIO PIN has some limited amperage? I remember discussing it with someone before who claimed that GPIO pins are not designed to power the devices.

In that case, if I wanted to power the fan directly from 5V PIN, then my Solid Relay wouldn't be used at all? I mean, in the program I would set the 5V PIN to act as RPM, and it would periodically cut and power the fan again? Or I have a wrong understanding on it?

So for (potentially) saving the USB HUB, there isn't some frequency that would match 50 HZ that is in electrical outlets? Or it doesn't matter at all?

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

Oh yes, wrong understanding.

There is a confusion between GPIO header and GPIO pins.

"GPIO header" is what RasPi folks started calling those 40 pins, most of which are GPIO, but certainly not all.
GPIO, General Purpose Input/Output are programmable pins that you can control. However digital GPIO handles only 3.3V logic, and can source or sink about 1-2mA.
If you want to control higher current than that, you need some sort of amplifier, a transistor, or your SS Relay.

Other pins on "GPIO Header" include GND, 3.3V, 5V - those are connected directly to respective power sources or ground plane.
N2 fan is powered from internal 5V rail, which is also exposed on "GPIO Header" pin (no. 1 or 2?). If you grab a multimeter you should register that these two are in fact internally shorted. If you want to try it, your N2 must be disconnected from the power source.
This 5V pin can source as much current as the internal 5V generator can handle, which might be 2A or so. If you exceed rated current, in the best case your N2 will "Brown Out" and reset. In the worst case it will get damaged.
For this very reasons, you cannot just disable a 5V pin, or 3.3V, or 1.8V pin. Those are not GPIO that can be controlled, just constant voltage sources.

5V provided by USB (Commonly known as Vbus) is slightly different, because it's the same 5V but routed through a power switch with current limiter, at about 1.3A if I'm not mistaken. This switch is controlled by the OS driver. No, don't PWM it. ;)

So on the second thought, perhaps it's wiser to power the fan from USB port, because there is at least some kind of protection in case something goes wrong.

50Hz in the outlets has nothing to do with this matter. If your N2 was battery powered your concerns would be the same.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

Thanks for the long explanation!

So just to summary, if I ever needed 0.5 A (or something around that) for the fan, I could connect it to PIN 2 (5V Power) On Odroid N2, and any Ground PIN, and that should deliver as much power as needed? That's pretty cool.

I think I should keep it USB-Hub powered for now not to break something again :)

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

That is correct, 5V and 3.3V, and GND are there to supply things connected to "GPIO header".
Check out my FPGA playground as an example. Everything on this M1S addon is powered from voltage sources on M1S.

viewtopic.php?p=379311#p379311
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

Good news! I couldn't resist thinking about these dedicated fan slots, so I bought some new soldering stuff (I used the old dad's stuff before). I managed to solder the pins correctly this time (using some better cable):

20240705_185555.jpg
20240705_185555.jpg (611.95 KiB) Viewed 198 times
(I added more red tape after taking this photo)

The fan starts correctly with:

Code: Select all

echo 20000 > /sys/devices/virtual/thermal/thermal_zone0/trip_point_4_temp

The only thing I noticed is a very strange sound when the fan is starting / stopping (after changing the temp for trip_point_4_temp). It has some strange louder noise then, but once it spins up fully, it's fine.

Maybe I also need to set some frequency for the default fan?

20240705_190817.jpg
20240705_190817.jpg (561.89 KiB) Viewed 198 times

Either way, I'm going to play with trip_points now and see how it works :) The soldering feels solid as I tested it by pushing a little :)

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

I'm very confused. It seems like there's this weird, loud squeak noise when the fan is not running with the full speed. The noise seems to continue even when I stop the fan with the finger. I'm scared if it doesn't come from Odroid directly...

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

I think that your solid state relay is designed to switch high voltage like 230V AC. Thus it may be thyristor based, which introduces voltage drop of around 1.4V.
This doesn't matter to 230V devices if they receive 228.6V instead, but may have caused your fan to be "underclocked".

What you hear now is your fan operating at actual 5V. It may just be that loud, and you didn't know that before.

This soldering job looks way better than the last one, clearly your skills and equipment have improved!
This is a useful skill in our electronically driven world.
Moan wrote:
Sat Jul 06, 2024 2:59 am
I'm very confused. It seems like there's this weird, loud squeak noise when the fan is not running with the full speed. The noise seems to continue even when I stop the fan with the finger. I'm scared if it doesn't come from Odroid directly...
This may be audible PWM frequency that drives the fan. When running at full speed, there is no PWM waveform (there's constant voltage instead) so you can't hear anything.
It's a question for @tobetter if the device tree can be modified to select a different frequency. But otherwise, it's not anything to worry about. Your fan is just louder than others.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

Haha, look:

https://mega.nz/file/sc1Bkb5A#UpCoSZqn4 ... ZqbxDufq54

It's really scary. When I change the trip_point_3_temp instead, it's this (or even worse) squeak all the time.

So is it normal that this noise continues even when I manually stop the fan spinning with the finger? It didn't happen at all with the relay thanks to voltage jumps :(

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

Wow, that is really loud indeed.

Yes, the noise that is audible even if you stop the fan (and in general doesn't depend on fan speed) indicates it comes from PWM, which has fixed frequency.
I analyzed this sound sample and it sounds so weird because the frequency is variable. That's strange..

Try to figure out what is the source of the sound. My motorbike mechanic used plastic tube to pinpoint where the sound is exactly coming from.

If it's the fan, and I suspect it is, then that's just a crappy fan.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

mctom wrote:
Sat Jul 06, 2024 4:40 am
I analyzed this sound sample and it sounds so weird because the frequency is variable. That's strange..
That's because I typed:

Code: Select all

echo 20000 > /sys/devices/virtual/thermal/thermal_zone0/trip_point_4_temp; sleep 10; echo 75000 > /sys/devices/virtual/thermal/thermal_zone0/trip_point_4_temp;
It seems like the fan first starts spinning up "softly", and then stops softly (controlled by the OS / kernel / whatever).

Either way, that's terrible.

I read a bit about https://wiki.odroid.com/odroid-c4/appli ... odroid-n21

Code: Select all

root@odroid:/sys/class/pwm/pwmchip4/pwm0# echo 1000000 > period
Unfortunately the default fan (whichever pwmchip it is in) doesn't have the "period" thing. That could potentially help.


Maybe I should connect it from the current fan pins to that Solid Relay module... and maybe it'd reduce 5V spikes to be softer. But it's still weird that with the Relay it was literally noise-free. Like I'd expect to notice this noise before, and it was just pretty quiet and fine...

And yes, the fan is a source of this noise. I tested by moving it a bit away from Odroid.

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

The fan PWM is controlled by GPIO, but that particular one is controlled by a fan PWM kernel driver. It cannot be overridden like any other GPIO.
I looked into the source code of N2 kernel and analyzed audio sample but couldn't figure out what frequency that was supposed to be. Something weird is going on.

I think that with solid state relay it behaved quietly just because you used much lower frequency, around 20Hz, which is barely audible. Lower effective voltage might have helped too.

You could build a proper fan driver, which is a single transistor. I'll find a schematic shortly.
Then you could use three pins from GPIO header: 5V, GND and any GPIO, and my code that you modified to suit your needs.
Your father might have a MOSFET transistor somewhere.. 1N7000 is very popular, but almost any other will be okay too.

One schematic is the simplest you could do, but transistor will have to be rated for at least 10V. The resistor is optional.
More sophisticated circuit is recommended because it's much safer for N2 GPIO pin. R4 can be omitted.
Attachments
th-2064072142.jpg
th-2064072142.jpg (8.13 KiB) Viewed 173 times
th-3919939604.jpg
th-3919939604.jpg (16.7 KiB) Viewed 173 times
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

mctom wrote:
Sat Jul 06, 2024 5:40 am
I think that with solid state relay it behaved quietly just because you used much lower frequency, around 20Hz, which is barely audible. Lower effective voltage might have helped too.
I tried with the default (100) frequency, as well as 500 and it all worked the same way, without that noise. It's more likely that this Relay Module has some voltage cumulation and possibly depending on pwm value it simply delivers a lower voltage to the fan. So possibly at 0.1 pwm it receives 0.05 V... But it it's just guessing.

For building a fan driver... I think it simply ends up on not using the dedicated fan pins in Odroid :( So I could simply return to the Solid State Relay module instead (as I for sure don't have this transistor). Not to mention that I don't understand these schematics :D

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

Go back to solid state relay then. It surely doesn't have any meaningful energy capacity, and it would be very hard to find explanation without oscilloscope captures. :)
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

I'll wait a bit before disconnecting the fan again. Maybe @tobetter would have some magic solution as usual. I also found this answer: https://arduino.stackexchange.com/a/36217 so this indeed is something about the frequency that we are currently unable to tweak.

EDIT:

So in /boot/dtbs/6.1.85-arm64/amlogic/meson64_odroidn2.dtb, I found:

Code: Select all

	pwm-fan {
		compatible = "pwm-fan";
		pwms = <0x69 0x00 0x9c40 0x01>;
		cooling-min-state = <0x00>;
		cooling-max-state = <0x03>;
		#cooling-cells = <0x02>;
		cooling-levels = <0x00 0x78 0xaa 0xdc>;
		phandle = <0x48>;
	};
Should I risk and compile a new dtbo file with:

Code: Select all

/dts-v1/;

/ {
    fragment@0 {
        target = <0xffffffff>;

        __overlay__ {
            pwms = <0x69 0x00 0x1e8480 0x01>; // Set period to 32258064ns (0x1e8480) (31Hz) and duty cycle to 1
        };
    };

    __fixups__ {
        pwmfan = "/fragment@0:target:0";
    };
};
?

Did AI calculate the frequency correctly? Hmmm...

EDIT:


Unfortunately no luck. It didn't change anything in the fan noise. Maybe I made the dbto file incorrectly?

EDIT:

This one also doesn't seem to work:

Code: Select all

/dts-v1/;
/plugin/;

/ {
    fragment@0 {
        target = <&pwm_fan>;

        __overlay__ {
            pwms = <&pwmgpio 0 0x1e8480 0x01>; // Set period to 32258064ns (0x1e8480) (31Hz) and duty cycle to 1
        };
    };

    __fixups__ {
        pwmfan = "/fragment@0:target:0";
    };
};
Compiling with:

Code: Select all

dtc -I dts -O dtb -o fan-pwm-31-hz.dbto fan-pwm-31-hz.dts
I dump it with:

Code: Select all

dtc -I fs /proc/device-tree -O dts -o current_device_tree.dts
And nothing is changed after reboot.

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

I've got a small update!

I was able to change the frequency from the default 25Hz (40000 µs(p)).
Thanks to @meveric who recommended to use fdtput instead to modify the meson64_odroidn2.dtb file directly.

This is what I used for 31Hz:

Code: Select all

dtc -I dtb -O dts -o /boot/dtbs/6.1.85-arm64/amlogic/meson64_odroidn2_original.dts /boot/dtbs/6.1.85-arm64/amlogic/meson64_odroidn2.dtb
cp /boot/dtbs/6.1.85-arm64/amlogic/meson64_odroidn2.dtb /boot/dtbs/6.1.85-arm64/amlogic/meson64_odroidn2.dtb.backup
fdtput -t x /boot/dtbs/6.1.85-arm64/amlogic/meson64_odroidn2.dtb /pwm-fan pwms 0x69 0x00 0x7DF2 0x01
But the problem was not gone. What partially fixed it for me was 100Hz:

Code: Select all

fdtput -t x /boot/dtbs/6.1.85-arm64/amlogic/meson64_odroidn2.dtb /pwm-fan pwms 0x69 0x00 0x2710 0x01
However the weird (but less weird) noise was still noticeable at the low fan speeds:

Code: Select all

echo 10 | sudo tee /sys/class/hwmon/hwmon2/pwm1
while at higher speeds it felt like it's much faster than before, reducing the controlling possibilities.


So for now I decided to return to the Solid State Relay and that great program for controlling the speed (with my modifications). It works the best because even at low speeds there is no noise while the fan is rotating slowly.

Besides that, I connected the power directly to Odroid PIN 2 as you (@mctom) recommended. It seems like at the max speed the fan is rotating faster. Possibly the longer cables and all the extra soldiering I made reduced the voltage when it was used directly from the USB Hub / Odroid USB / external 5V charger. Thanks again, I really thought that the 5V output from GPIO PINs wouldn't be able to power fans.

At the end, I think it was a good coincidence that at first I damaged the Molex 51021-0200 port, because without that I wouldn't learn about the alternative method.

And one more fact: I ordered two fans, a cheaper one and a double-priced one with "two balls" (or something like this). The two balls version is super quiet. So I connected the cheaper fan to the dedicated FAN Pins on Odroid and it seems to work fine with default 25Hz. No strange noise or nothing. So I decided that I'll use that fan to cool down external HDDs when needed. I just need to figure out a method to check their current temperature without using smartctl, which wakes them up from the standby mode. I'll probably monitor if there's any transfer before checking with smartctl.

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

Well if the original PWM frequency was 25Hz then it's clear it has nothing to do with the noise that is well in kHz range.

If you want to go fancy, you can modify my program to support two fans, or run two different instances at the same time. :)

For independent HDD temperature monitoring, you may yet again learn something new and buy a temperature sensor, with either I2C, SPI, 1-Wire or analog output. All of them can be connected to N2.
1-wire temperature sensors are very popular among hobbyists, I think there is an article in Odroid Wiki how to use one with Odroids.
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

Moan
Posts: 157
Joined: Fri Feb 01, 2019 11:51 pm
languages_spoken: english
ODROIDs: N2, XU4
Has thanked: 26 times
Been thanked: 7 times
Contact:

Re: Buying the Odroid N2 fan

Post by Moan »

mctom wrote:
Sun Jul 07, 2024 6:27 pm
For independent HDD temperature monitoring, you may yet again learn something new and buy a temperature sensor, with either I2C, SPI, 1-Wire or analog output. All of them can be connected to N2.
1-wire temperature sensors are very popular among hobbyists, I think there is an article in Odroid Wiki how to use one with Odroids.
I made the HDD monitoring script: monitor-disks-temperature-for-fan yesterday.

It is getting a temperature from smartctl, but only if the disk(s) were recently used (not to wake them up from sleep mode). Then it adjusts the fan speed according to it. Works pretty well from what I can tell. Sometimes even a small airflow can make a difference.

User avatar
mctom
Posts: 4330
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 642 times
Been thanked: 875 times
Contact:

Re: Buying the Odroid N2 fan

Post by mctom »

Good job, a very smart solution indeed. :)
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

User avatar
mad_ady
Posts: 12102
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, N2L, H2, H3+, Go, Go Advance, M1, M1S
Location: Bucharest, Romania
Has thanked: 663 times
Been thanked: 1323 times
Contact:

Re: Buying the Odroid N2 fan

Post by mad_ady »

I just need to figure out a method to check their current temperature without using smartctl, which wakes them up from the standby mode
Unfortunatelly smartctl wakes up the disks when used. I use the following to see if the disk is active or spun down:

Code: Select all

ls -1p  /dev/disk/by-id | egrep 'ata-|usb-' | grep -v 'part' | while read disk; do active=1; /usr/sbin/smartctl -n standby -d sat /dev/disk/by-id/$disk > /dev/null || active=0; echo "disk_spin_status{disk=\"${disk}\"}" "${active}"; done
But note that if you decide to read temperatures with smartctl only when the disk is spun up, you may be preventing it from spinning down, because the controller may register your reads as "access", and keep the disk spinning even if you're not reading data from it.

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 4 guests