Published: 2014-11-29 | Categories: [»] Engineering, [»] Electronics, [»] Chemistryand[»] Videos.

Stirring a reactor or a beaker content is essential in regards to good homogenisation of both thermal and mass properties. For instance, many complex reactions will not process the same way in a stirred and unstirred medium due to local depletion phenomena. In some other cases, hot spots may form leading to improper or dangerous reactions. Finally, in the case of biotechnology, proper stirring is also essential to break the foam that may form on top of the reaction culture which can be detrimental to the exhaust gas system due to clogging issue. This latter case is particularly interesting because cell cultures require a form of soft mixing which cannot be met with conventional chemistry stir bars that would damage the cells.

The easiest way to achieve mixing is by placing a helix or any other mixer at the end of an axis driven by a motor. However, because of the rotational motion of the axis, it is difficult to use such designs in sealed or pressurized container. A common workaround for this is to use magnetic coupling between the motor and the stirring part. The motor drives a magnet which is placed close to the container containing a second magnet attached to the mixer element. When the motor magnet turns, it attracts the mixer magnet which applies the stirring motion. The situation is well known to chemists who use magnetic stirrers all the time.

Magnetic stirrers can be bought from chemistry suppliers but they are expensive (at least a few hundred dollars!). It might also look suspicious to order that kind of things and you may want to keep a low profile depending on your local country freedom restrictions. I therefore propose to build your own powerful magnetic stirrer for less than $100US from electronic spare parts and neodymium magnets. A photograph of the magnetic stirrer built for this post is given on Figure 1.

Figure 1

The most difficult parts you will need are a geared DC motor and big neodymium magnets. I have used a 19:1 geared 12V 500 rpm DC motor ordered from [∞] RobotShop (reference RB-Pol-123) which features a Pololu encoder to get a feedback on the actual rotation speed and magnets ordered from [∞] SuperMagnet (two 20 mm Φ x 10 mm magnets and two 5 mm Φ x 25 mm magets). For the case, just get one that is large enough to contain everything and have a large surface to put your beaker on. For those who manage to get the stuff from RobotShop and SuperMagnet shops, I have included some construction help at the end of the post. To ease motor holes drilling in the case, just print the drill-help.pdf file on an adhesive sheet that you can stick on the case to have good holes alignment.

Concerning the motor magnet support, I have tried a few different versions but the one I have uploaded works good. Just put the two large 20 mm x 10 mm magnets in the holes with one having its North pole facing up and the other one having its South pole facing up. Also, it is a good idea to find some steel or iron piece to put on the back to help closing the magnetic field lines so they won’t extend into the DC motor too much (you will probably have to drill a hole in the centre of your metal piece to let the motor axis go through – be careful that there should be a gap large enough between the axis and the metal piece so that the magnetic field does not enter in the motor axis). Figure 2 shows the configuration. The major issues I had with this design was to find a good distance between the two magnets; 50-70 mm seems to do the job. Also, you do really want to take great care of these large magnets because they attract themselves so strongly that you may hurt yourself (as did my girlfriend…).

Figure 2

For the mixer part, you may use classical chemistry stir bars bought on e-bay. They are cheap and work in corrosive media due to their PTFE coating. However, as pointed previously, most of them are not suitable for cell cultures mixing. You may find alternatives from chemical suppliers but they are expensive (when working on my PhD thesis I ordered a 1 litre, sealed soft-stirred beaker for about $500US! Lately, I’ve built a replica of this stirrer for less than a tenth of that price…). If you have trouble in that regards, you can use the turbine model I have included at the end of the post (this is also the mixer displayed on Figure 1). Once printed, just insert the two small magnetic rods inside the model and place it with the pointy-side facing down. You may eventually want to add silicon sealing to prevent the culture from entering in contact with the nickel coating of the magnets. I have engineered the model like a top-toy to avoid friction that may reduce efficiency and damage the cells. Be careful that the turbine was designed for clockwise rotation so check your motor wiring. Also, when you print the model, set the fill rate to the maximum. By default, most 3D printers will have low fill rates such that the model has a honeycomb structure. The result of this is a model full of air that will float on top of your beaker and won’t stir anything…

The final part of the magnetic stirrer is the motor control. If you are not the big boss of electronics, you can just wire the motor excitation and ground terminals to a 12 Volts battery or plug power supply. By changing the power supply value (like 5 Volts, 9 Volts etc.) you will be able to change the mixing speed. A good solution for this is the tuneable plug power supply that will let you choose between finite values such as 3/5/7/9/12 Volts. Just be careful not to use anything bigger than 12 Volts. If, on the contrary, you feel comfortable with electronics then you can do much more!

The circuit I am using includes a potentiometer to tune a speed command which controls a PWM output generated by a microcontroller. Because the motor includes a rotary encoder, we get a feedback from the actual speed and we can then tune the PWM duty cycle to match a precisely controlled mixing speed. One may argue that because the load on the motor is always the same (the inertia of the two driving magnets), PWM alone is sufficient. That’s true but controlling a precise rpm only requires a few more line of code and nothing more; so why not use it?

I have included the PCB at the end of the post and the components insertions are displayed on Figure 3. All the circuit does is read an analog voltage from the potentiometer, catch the encoder pulses (304 pulses/rev) using the “Interrupt 0” pin of the PIC16F688 microcontroller and drives a power transistor to turn the motor on/off for the PWM cycles. For the feedback command, I am using a simple integrator that update every 0.1 seconds.

Figure 3

The PICCLITE code is listed below. The microcontroller is set to generate a “Timer 1” interrupt every ~0.1 sec (using a 20 MHz crystal and a divider of 8) where it set a “process” bit to 1 to signal that an update is wanted. At each “Interrupt 0” event, a counter is increased to get the feedback (the count is reset every “Timer 1” event). In the main loop, the analog value of the command is read and the difference between the actual motor rpm and the command is taken to compute the updated PWM duty cycle. Finally, the “Timer 0” interrupts are used to generate a PWM signal with 1% accuracy in duty cycle (frequency about 1 kHz). Do not be surprised by the magic number 266 in the code, it is just the number of ticks in 0.1 sec intervals at 500 rpm (maximum motor speed at 12 Volts under no load).

#include <pic.h> unsigned short g_usTicks = 0; // number of ticks since last update unsigned short g_usCurrentSense = 0; // last sensor feedback value unsigned char g_ucCurrentPWM = 0; // current PWM duty cycle from 0 to 100 unsigned char g_ucPWMClock = 0; // PWM clock from 0 to 100 bit g_bUpdate = 0; // update bit void init(void) { /* turn off comparator */ CMCON0 = 0b00000111; /* RA0 as analog input */ TRISA0 = 1; /* RA1 as PWM output */ TRISA1 = 0; /* RA2 as I/O input for feedback */ TRISA2 = 1; /* enables interrupts for RA2 */ INTE = 1; /* RA0 as analog */ ANSEL = 0b00000001; ADCON1 = 0b00100000; /* timer 0 no presacler */ T0CS = 0; PSA = 1; PS0 = 0; PS1 = 0; PS2 = 0; T0IE = 1; /* timer 1 on, prescaler set to 8 */ TMR1IE = 1; T1OSCEN = 0; TMR1CS = 0; T1CKPS0 = 1; T1CKPS1 = 1; TMR1ON = 1; TMR1L = 0; TMR1H = 0; PEIE = 1; } void interrupt ctrl(void) { /* triggers every 0.025 ms */ if(T0IF) { TMR0 = 128; /* PWM output */ RA1 = (g_ucCurrentPWM > g_ucPWMClock) ? 1 : 0; if(g_ucPWMClock < 100) g_ucPWMClock ++; else g_ucPWMClock = 0; T0IF = 0; } /* triggers every 0.105 sec */ if(TMR1IF) { TMR1IF = 0; g_usCurrentSense = g_usTicks; g_usTicks = 0; g_bUpdate = 1; } /* update tick count */ if(INTF) { INTF = 0; if(g_usTicks < 0xffff) g_usTicks ++; } } /* read analog from AN0 */ unsigned short analog(void) { ADCON0 = 0b10000001; ADIF = 0; for(unsigned char c=0;c<50;c++); ADCON0 = 0b10000011; while(ADCON0 & 2); return (((unsigned short)ADRESH) << 8) | (unsigned short)ADRESL; } void main(void) { init(); GIE = 1; unsigned long ulAnalog = 0; unsigned long ulSum = 0; float fCommand = 0; while(1) { /* sum up values to compute average - this reduce noise figures */ ulAnalog += (unsigned long)analog(); ulSum ++; /* wait the update bit */ while(!g_bUpdate); /* compute the actual potentiometer command from 0 to 266 (max rpm) */ float fConsign = (float)(ulAnalog / ulSum) * 266.0 / 1024.0; /* compute epsilon, disable interrupts to prevent modification to g_usCurrentSense during copying */ GIE = 0; float fEpsilon = fConsign - (float)g_usCurrentSense; GIE = 1; /* PWM command integral */ fCommand += (0.5 * 100.0 / 266.0) * fEpsilon; if(fCommand > 100.0) fCommand = 100.0; else if(fCommand < 0.0) fCommand = 0.0; /* set the current PWM command, disable interrupts to prevent reading during modification */ GIE = 0; g_ucCurrentPWM = (unsigned char)fCommand; GIE = 1; /* reset update bit and analog averaging procedure */ g_bUpdate = 0; ulAnalog = 0; ulSum = 0; } }

You can check the effects of various magnets arrangements in our video:


You will find here the various resources required for the magnetic stirrer. Depending on your 3D printer, you may experience different result than the one reported here such as tighter or looser holes to place the magnets. If the holes are too big, try to fix them using silicon sealing or even glue. When printing the turbine model, be sure to set the fill rate to the maximum to prevent your model from floating on top of your beaker.

- [∞] drill-help.pdf to help drilling the holes.

- [∞] pcb.pdf to print the circuit board (warning: depending on your UV exposure unit, you may have to flip the drawing horizontally before printing).

- [∞] turbine.stl to print the mixer model.

- [∞] stirrer.stl to print the stirring base model.

[⇈] Top of Page

You may also like:

[»] Flow-rate Controlled Peristaltic Pump

[»] Working with Pressure Sensors and Load Cells

[»] Over-pressure Electric Valve

[»] OpenRAMAN LD & TEC Drivers

[»] Ultra-low Flow Rates with DIY Syringes Pumps