# Processing + OSC + Arduino: Application Freezes When Controlling Fan

**URL:** <https://discourse.processing.org/t/processing-osc-arduino-application-freezes-when-controlling-fan/47568>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [November 26, 2025, 9:16am UTC](https://discourse.processing.org/t/processing-osc-arduino-application-freezes-when-controlling-fan/47568 "2025-11-26T09:16:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![brightscape](https://avatars.discourse-cdn.com/v4/letter/b/b19c9b/32.png) [@brightscape](https://discourse.processing.org/u/brightscape)\
**Post date:** [November 26, 2025, 9:16am UTC](https://discourse.processing.org/t/processing-osc-arduino-application-freezes-when-controlling-fan/47568/1 "2025-11-26T09:16:33Z")

</div>

Hi There, I was wondering if anyone could help me. I am trying to drive a fan/motor using an OSC command. It’s running well through via an arduino to a potentiometer controller on the fan. I have used OSC as the button push which triggers the fan also needs to trigger other actions. It sometimes works well, but sometimes the application ‘hangs’. This can be after a couple of hours of running or sometimes after 5 minutes of running.

I generally have to power cycle the arduino and computer to get the processing application to function correctly again.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 26, 2025, 4:29pm UTC](https://discourse.processing.org/t/processing-osc-arduino-application-freezes-when-controlling-fan/47568/2 "2025-11-26T16:29:19Z")

</div>

Hello @brightscape,

Have you tested the setup with the fan disconnected?  
Electrical noise or power fluctuations from the fan can interfere with the microcontroller and cause communication problems.

The guidelines here are helpful:  
_[Welcome to the Processing Foundation Discourse](https://discourse.processing.org/t/welcome-to-the-processing-foundation-discourse/8)_

`:)`

---

<div class="post-metadata">

**Author:** ![brightscape](https://avatars.discourse-cdn.com/v4/letter/b/b19c9b/32.png) [@brightscape](https://discourse.processing.org/u/brightscape)\
**Post date:** [November 27, 2025, 1:48pm UTC](https://discourse.processing.org/t/processing-osc-arduino-application-freezes-when-controlling-fan/47568/3 "2025-11-27T13:48:56Z")

</div>

Thank you glv for your response.

I have a counter on the application and it ran for 42,039 seconds from the most recent button press before it started to hang.

I will try with the fan disconnected. If this is the problem is there any workaround?

Thanks again,

Brian

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 27, 2025, 4:14pm UTC](https://discourse.processing.org/t/processing-osc-arduino-application-freezes-when-controlling-fan/47568/4 "2025-11-27T16:14:47Z")

</div>

> [@brightscape](#):
>
> I will try with the fan disconnected. If this is the problem is there any workaround?

There are best practices for control systems and isolation of what you are controlling.  
If you turn stuff on and off and it resets Arduino you will know.

Try and generate a minimal example that reproduces the problem.

Details help to resolve issues in systems like this.

OS?  
Processing version?  
OSC library?  
Are working over WiFi?  
Using serial?

What do you observe when it hangs?  
Anything in the Processing console to share?

`:)`

---

<div class="post-metadata">

**Author:** ![brightscape](https://avatars.discourse-cdn.com/v4/letter/b/b19c9b/32.png) [@brightscape](https://discourse.processing.org/u/brightscape)\
**Post date:** [November 27, 2025, 4:36pm UTC](https://discourse.processing.org/t/processing-osc-arduino-application-freezes-when-controlling-fan/47568/5 "2025-11-27T16:36:03Z")

</div>

Again, thank you for your time.

I will look into the control systems and isolation best practice.

OSX 15.7.2

Processing 4.4.10

I changed the OSC out for a Midi library, but I’m still having the same issue.

It’s not working over WIFI, it is using serial although the macmini is connected to WIFI.

When it hangs, it just freezes, it doesn’t respond to the midi or osc. The app won’t quit or force quit after it hangs so I need to power cycle both the machine and the fan to get it to work successfully.

Much appreciated!

---

<div class="post-metadata">

**Author:** ![brightscape](https://avatars.discourse-cdn.com/v4/letter/b/b19c9b/32.png) [@brightscape](https://discourse.processing.org/u/brightscape)\
**Post date:** [November 27, 2025, 4:38pm UTC](https://discourse.processing.org/t/processing-osc-arduino-application-freezes-when-controlling-fan/47568/6 "2025-11-27T16:38:26Z")

</div>

I can’t see anything on the console as it is running on the standalone app right now.

Next time it crashes I will run it through processing and see if there is anything of note on the console.

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 27, 2025, 5:58pm UTC](https://discourse.processing.org/t/processing-osc-arduino-application-freezes-when-controlling-fan/47568/7 "2025-11-27T17:58:35Z")

</div>

Hi,

These can be difficult to diagnose remotely (me being remote):

> [@Please help, code crashes and I can't figure out why](https://discourse.processing.org/t/please-help-code-crashes-and-i-cant-figure-out-why/47440/5):
>
> Please to see that you got it sorted out! Happy Hallowe’en! slight_smile

Serial communications can be a challenge as well and cause issues.

Check the _console folder_ for logs in the same folder as _preferences.txt_ (down at bottom):

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/c/e/ceda5b62c302569759b10947046d0964568edeca.png)

It logs the console output to the best of my knowledge.

Keep at it!

`:)`

---

<div class="post-metadata">

**Author:** ![RichardDL](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@RichardDL](https://discourse.processing.org/u/RichardDL)\
**Post date:** [December 9, 2025, 7:58pm UTC](https://discourse.processing.org/t/processing-osc-arduino-application-freezes-when-controlling-fan/47568/8 "2025-12-09T19:58:38Z")

</div>

Hi @brightscape Is this still a problem? Please say what type of Arduino you have?
