Temp sensing ... mini ?

I’m building a hand piece for engraving with a soleonid … and it get hot too quickly !

Anyone here experinented with a sensor from a heating element for a 3D printer - maybe some sample code for arduino - I want to control a mini fan for cooling the soleonid.

Keld From Denmark !
A Fairy tale country
In the North of EU

What does that mean, exactly? Off or on or speed or direction of rotation?

In the first place ON/OFF but if the code for speed easy … then why not this too :wink:

I just need some sample code to play with and get some knowledge.

You can be very specific in an internet search for exactly what you want, for code or circuit. In your reading, you might learn to solve the cause of the problem, avoiding the symptom.

Running a fan is not just about code for the mini. You need to supply the fan with power, and control that power, either on/off or speed, if the fan has a PWM pin.

An on/off sketch could look like this...

int pinTemp = A0; // thermometer
int pinFan = 13; // on/off

void setup() {
  Serial.begin(115200); // start serial comms
  pinMode(pinTemp, INPUT); // configure thermometer pin
  pinMode(pinFan, OUTPUT); // configure fan pin
}

void loop() {
  int value = map(analogRead(A0), 0, 1023, 0, 2); // map the thermometer (0, 1023) to OFF/ON (0/1)
  digitalWrite(LED_BUILTIN, value); // use the mapped value
  Serial.print(value); // show the mapped value
}

Where is the solenoid located at, in the hand piece or remote. What is your assumed power source? What else are you doing besides running a fan? Which controller are you thinking of using? You can get a simple temperature for less then two packs of cigarettes.

I have some of these bigger temp sensors kind of DS18B20 but they are way to big … I’ve seen one from my 3D printer - but it looks just like 2 leads soldered together and in fact I think they are - but how can it be read by Mr.Arduino … I don’t know how the SW in the 3D-printer manage to read the temperature.

You say “Power to the fan’ … yeah, but we’re talking about a 20X20X6mm 5V fan to be incoorporated in the hand piece for engraving - I think it can be driven directly from the Arduino.

@gilshultz

It’s a small one included if the handpiece together with the fan :disguised_face: - at least I plan it so :grinning_face_with_smiling_eyes:

Sounds like a thermocouple (probably type K)
Might take a look at the MAX31855 (ao)

See

you need an additional board with this

No. Size has nothing to do with power required. Find the specifics for the fan and a power supply circuit the right size for the fan. Arduino is a controller to control the fan.

Thermocouples can look like that. Usually spotwelded together. In any case you will require an instrumentation amplifier to bring the voltage up to something your Arduino can read.

@xfpd

Yeah, I know that … as I remember it draws 20mA

My local store sells "100k glass bead thermistors".
I think they are a common part for 3D printer heatbeds.

Connect to pin/ground with internal pull up on the pin.
Leo..

Really? Do you have a backup Arduino?

Glass bead thermistors are available in many base resistance values and sizes (some even microscopic) from specialty companies and most suppliers of electronic components.

Example

There are MAX modules for the Arduino that read thermocouples, manly K but not limited to them.

I doubt OP needs an accurate temp for that solenoid. "Almost too hot" might be enough.
A bead thermistor does not need additional hardware and is good enough to give you temps within a couple of degrees.
Leo..

THX to all of you - I think I have a LOT of stuff now to start studying and do some testing !

Keld From Denmark !
A Fairy tale country
In the North of EU

I think you are curing the symptom and not the cause.
If the solenoid is geing hot then maybe it is not the correct type, or you are using to high a voltage or your duty cycle is too high.

@jim-p

Yeah, you just right but when engraving I think one HAVE to have it ‘hammering’ continously and solenoids normaly is NOT happy running continously !

I’m just in the planing stage … I think the ‘hammering’-frequence is dictated by an Arduino and the intensity of each stroke is managed by a PWM

Now I have to go to the bench for experimenting :disguised_face:

Nonesense. Industrial solenoids run continuously for days on end! Use a solenoid designed for that service and use a proper hear sink. Another option is to use 4X the rated voltage for 1/4 the time. Get the armature to move as quickly as possible and cut the current very quickly. I have had equipment run 32 volt solenoids at 100 volts DC for years. One could fire about once a second.