Custom control of Fan0 and Fan1 - How to???

Having a problem? Post it here and someone will be along shortly to help
Post Reply
kanDO_Bryce
Plasticator
Posts: 15
Joined: Sun Mar 01, 2015 10:55 pm

Custom control of Fan0 and Fan1 - How to???

Post by kanDO_Bryce »

Hi all

I have a Rostock max v1 that is running dual extruders.
I am currently cooling the PEEK sections of the hot ends with a compressed air supply, which I turn on and off manually.
I have the machine inside a heated cabinet, and I also turn the heater unit [that heats the cabinet] on and off manually.

What I need to do is:
- configure the Fan0 port on the RamBO to produce a 12V* signal whenever either Extruder 0 or Extruder 1 is switched on - to operate a flow valve for turning the compressed air supply on and off
- configure the Fan1 port on the RamBO to produce a 12V* signal whenever the bed heater is switched on - to operate a relay for turning the cabinet heater on and off

(*Signal could be any voltage I guess, 3V, 5V, 10V, 12V... so long as it is consistent so it can operate a relay)

However, I have absolutely no idea what I'm doing when it comes to editing the firmware. What would I need to change in / add to the firmware to achieve this?

Thanks in advance. This is what happens when mechanical engineers try to play wit things that involve programming :?
Xenocrates
ULTIMATE 3D JEDI
Posts: 1561
Joined: Wed Sep 23, 2015 2:55 pm

Re: Custom control of Fan0 and Fan1 - How to???

Post by Xenocrates »

here's an idea, hook the relay up to the mosfet for the bed, with an optioisolator rated for the current between the bed and the relay, and then hook the relay for the compressed air up to heat1, or whatever the stock firmware pin is. That way you don't need to do any mucking about in the firmware, and it can't glitch out on you that way.

Mind you, you might try adding additional output pins for the heated bed to pins.h in the firmware. I have no idea how well it would work, but then you could potentially ditch the optioisolator.

I'm not an electrical engineer, nor that sort of programmer (I program robots and machine tools), but this seems like a pair of perfectly sensible options, so at least one should work (in theory). I am interested though, are you using another 4MM PTFE tube to move the compressed air to the effector? Because that would be largely sensible, as it would increase commonality of parts, and give you a fairly good conductor for the air to travel in. What sort of pressure and CFM (or SCFM), are you delivering to the effector? Are you mounting the compressor inside the cabinet, or externally? How close to the cabinet temperature is your air supply? Have you put thought into directing it upwards and diffusing it, to reduce the draft it would cause, or else perhaps thought about a minor suction line, to remove most of the air that you don't want (a venturi pump might do it, but would increase the duty cycle on your compressor, and possibly push your supply capacity.

Hope things go well for you.
Machines:
Rostock Max V2, Duet .8.5, PT100 enabled E3D V6 and volcano, Raymond style enclosure
Automation Technology 60W laser cutter/engraver
1m X-carve router

Sic Transit Gloria Mundi
01-10011-11111100001
geneb
ULTIMATE 3D JEDI
Posts: 5358
Joined: Mon Oct 15, 2012 12:47 pm
Location: Graham, WA
Contact:

Re: Custom control of Fan0 and Fan1 - How to???

Post by geneb »

I'm willing to bet that the back-emf from the relay will blow the output MOSFETs on the RAMBo board.

g.
Delta Power!
Defeat the Cartesian Agenda!
http://www.f15sim.com - 80-0007, The only one of its kind.
http://geneb.simpits.org - Technical and Simulator Projects
Xenocrates
ULTIMATE 3D JEDI
Posts: 1561
Joined: Wed Sep 23, 2015 2:55 pm

Re: Custom control of Fan0 and Fan1 - How to???

Post by Xenocrates »

If opto-isolated, there is no back EMF (this is for wired straight through the bed) Now, you might be right on the one for the heat1 pin, although that too can be opto-isolated. However, people have had good luck driving SSRs through the bed output. I'm not sure if just using relay generically to cover both mechanical and solid state relays is technically right, but it's how I've always thought about it, since both are relays, even if they work through different methods, and both within the same switching style behave the same way. I tend not to think about ice-cube relays much. Or you could use a diode to help suppress the back EMF. http://progeny.co.uk/back-emf-suppression/ describes a few methods of EMF suppression.
Machines:
Rostock Max V2, Duet .8.5, PT100 enabled E3D V6 and volcano, Raymond style enclosure
Automation Technology 60W laser cutter/engraver
1m X-carve router

Sic Transit Gloria Mundi
01-10011-11111100001
kanDO_Bryce
Plasticator
Posts: 15
Joined: Sun Mar 01, 2015 10:55 pm

Re: Custom control of Fan0 and Fan1 - How to???

Post by kanDO_Bryce »

Xenocrates - Thanks for your ideas there. Forgive me if i have gotten the wrong end of the stick, but are the MOSFETs you are talking about the green terminals at the top that you screw the cables for the extruders/fans/bed into? If so, then these are not so handy for being directly used with any sort of relay as they don't just output a 12V 'ON' or a 0V 'OFF' signal, they are PWM controlled. That's why i was hoping to configure some binaryesque 12/0V output to the two sets of fan ports that I am currently not using, and run relays off of those.

geneb - do you know what the frequency of the PWM control is, on those outputs? if it is a very high frequency then something like this may work as the optoisolator would not have time to switch off?

Xenocrates - to answer you questions about the air, I am running a 4mm air hose to a T splitter that sits in between the two hot ends - the two exhausts of the T splitter are directed at the PEEK barrels to keep them cooled. The air compressor is external to the cabinet, so the air being used for cooling is at abut 20 Celsius i imagine. The cabinet temperature is usually 40-50 Celsius. The air I am supplying is going through a pressure regulator, I am sending it out at about 0.8 bar. I have not got the means to measure the CFM, sorry. This setup has been working really well, the PEEK barrels seem very happy.
geneb
ULTIMATE 3D JEDI
Posts: 5358
Joined: Mon Oct 15, 2012 12:47 pm
Location: Graham, WA
Contact:

Re: Custom control of Fan0 and Fan1 - How to???

Post by geneb »

I doubt there's optos on the RAMBo board, but you'd have to check the schematic to make sure.

Solid state relays don't have the back emf issue that motors, solenoids and coil-based relays do.

g.
Delta Power!
Defeat the Cartesian Agenda!
http://www.f15sim.com - 80-0007, The only one of its kind.
http://geneb.simpits.org - Technical and Simulator Projects
kanDO_Bryce
Plasticator
Posts: 15
Joined: Sun Mar 01, 2015 10:55 pm

Re: Custom control of Fan0 and Fan1 - How to???

Post by kanDO_Bryce »

geneb - I think we (I am at least) were on about adding external optocouplers (or solid state relays now that you mention it), and triggering those off of the PWM signal being supplied by the MOSFETs. Do you know what the frequency of the PWM control is, on those outputs? [roughly is fine... order of magnitude even]
Xenocrates
ULTIMATE 3D JEDI
Posts: 1561
Joined: Wed Sep 23, 2015 2:55 pm

Re: Custom control of Fan0 and Fan1 - How to???

Post by Xenocrates »

If there were optos on the rambo board, then someone may have missed the point of optos. They are, as you are more than likely well aware, sacrificial elements, as well as a method of isolating things from environments that could kill them. If you place them on the main board, and don't socket them, I would probably just add another opto past that, because I want to be able to replace it.

From what I can find, the firmware for the peek fan usually leaves it at full duty cycle, thus fully on, so long as the hot end is above 40 C. The standard ATmega2560 PWM timer frequency appears to be 490Hz. So not too fast. From the looks of other sites, it looks like the PWM frequency on the rambo is in the 255 range. I do wish I had an oscilloscope to check it for you, but I'm not an EE, or an electronics tech. If you can borrow a few moments of scope time at work or similar, or at a makerspace, that should get you an idea for the bed. Or you could swap the bed to bang-bang heating mode, which runs it at full power ( i think), and is less precise than PID, but also would drop out the PWM crud. Or else wire a capacitor to the relay, to smooth the signal from the opto. I think (again, not an electronics guy), that a capacitor or something before the opto would do it too. Not sure. Of course, if you use an SSR, it should have no trouble, keeping up with the switching speeds.
Machines:
Rostock Max V2, Duet .8.5, PT100 enabled E3D V6 and volcano, Raymond style enclosure
Automation Technology 60W laser cutter/engraver
1m X-carve router

Sic Transit Gloria Mundi
01-10011-11111100001
Eric
Printmaster!
Posts: 717
Joined: Sat Aug 18, 2012 4:09 am
Location: Chula Vista, CA

Re: Custom control of Fan0 and Fan1 - How to???

Post by Eric »

~500Hz (double for timer 0) are usually the bootloader defaults, but no programmer worth their salt assumes startup defaults are correct. Assume the software has set the timer frequencies to what it wants before using the PWM features.

The various PWM outputs on an Arduino Mega are associated with timer/counter registers, the frequency of which can be adjusted in software by setting the prescaler bits. There are six seperate timers, each responsible for 2-3 PWM outputs, which can be independantly set so different ports can run at different speeds. Timer 0 can be run as fast as 62500 Hz, while the rest top out at 31372.5 Hz. That's just my arduino knowledge talking; I don't actually know your answer without hunting in the code for whichever firmware you're using. Attaching a scope to a port set to 50% output might be the fastest way to know for sure.

Of course, if you only use 0% duty cycle (OFF) and 100% duty cycle (ON), then the frequency is irrelevant (so-called bang-bang mode). It's just a switched output then. I think that's what you wanted in your original question.
kanDO_Bryce
Plasticator
Posts: 15
Joined: Sun Mar 01, 2015 10:55 pm

Re: Custom control of Fan0 and Fan1 - How to???

Post by kanDO_Bryce »

Ok, so it looks like running a relay/opto off of the bed and ex0 outputs will only work if they are in bang-bang mode, which is not really a viable solution as the PWM temperature control on those is pretty crucial.

So, what I wanted to do in the first place was to set up this kind of logic...

IF (Ex0 is on)
Fan0 ON 12V
ELSE
Fan0 OFF 0V
ENDIF

IF (Bed is on)
Fan1 ON 12V
ELSE
Fan1 OFF 0V
ENDIF

Are there any firmware modding wizzes who would know how to do that?
joseph
Prints-a-lot
Posts: 21
Joined: Sat Jan 17, 2015 6:34 pm

Re: Custom control of Fan0 and Fan1 - How to???

Post by joseph »

Why don't you get the Rambo spec sheet and the wiring manual, and see what the power management system is. It is probably just an arduino pin issue that has a setting line in the firmware. The "fan" setting doesn't care what it's running.
User avatar
Eaglezsoar
ULTIMATE 3D JEDI
Posts: 7159
Joined: Sun Apr 01, 2012 5:26 pm

Re: Custom control of Fan0 and Fan1 - How to???

Post by Eaglezsoar »

Normally when using a coil based relay, a diode is added across the coil leads so that the induced back EMF is dumped to ground.
I do not recommend using coil based relays however, the constant click click or buzzing is something that becomes quite annoying.
Polygonhell
ULTIMATE 3D JEDI
Posts: 2417
Joined: Mon Mar 26, 2012 1:44 pm
Location: Redmond WA

Re: Custom control of Fan0 and Fan1 - How to???

Post by Polygonhell »

kanDO_Bryce wrote:Ok, so it looks like running a relay/opto off of the bed and ex0 outputs will only work if they are in bang-bang mode, which is not really a viable solution as the PWM temperature control on those is pretty crucial.

So, what I wanted to do in the first place was to set up this kind of logic...

IF (Ex0 is on)
Fan0 ON 12V
ELSE
Fan0 OFF 0V
ENDIF

IF (Bed is on)
Fan1 ON 12V
ELSE
Fan1 OFF 0V
ENDIF

Are there any firmware modding wizzes who would know how to do that?
You'd have to change the source code, it wouldn't be very difficult, there is already code in there for the hotend fan that is basically
if (Hotend is on OR over 50C)
Fan on
else
Fan off

you could trivially piggy back off that.

In the default SeeMe version of the source code, I believe that the hotend fan is mapped to the extruder1 Heat output, rather than extruder1 Fan.
The Fan and hotend outputs are all electrically identical, so it doesn't really matter, but you can change it in a combination of pins.h and configuration.h.
Post Reply

Return to “Troubleshooting”