# Using the Syren 10A Motor Driver with a RPI-zero to drive a Peltier

I'm kinda new on how to drive power consuming devices such a Peltier with a microcontroller and I would like to hear your opinion.

So I have bought the following parts:

And I'm intended to drive the Peltier using the Driver with an external 12V power supply. After reading driver's manual I concluded to the following schematic:

But since I'm new to using that kind of driver I'm not sure If I'm thinking it right. Also, this driver operates in many modes and as far as I can understand the analog is the one that I have to use together with PWM from the RPI-zero side.

Does anyone have any more experience with that driver to guide me with it? Any idea or hint, of course, is welcome.

EDIT:

I made some changes and here are the steps:

1. I connected exactly as I draw it in the image.
2. I set the DIP switch with 1 and 6 up as manual described on chapter Switch 6: R/C Failsafe Timeout in page 12
3. I assumed that the driver needs 50Hz frequency for the R/C PWM.
4. Then I did the math to calculate the period

F = 50 Period = 1 / 50 = 0.02 s = 20 msec

5. According to the manual at page 11 where " A 1500us pulse is zero speed, a 1000 us pulse is full reverse and a 2000 us pulse is full forward" I calculated the duty cycle for each of them like:

For full reverse 1000usec = 1msec pulse width is needed. So 1msec is 1 / 20 = 5% of the duty cycle

For stop 1500usec = 1.5msec is needed. So 1.5msec is 1.5 / 20 = 7.5% of the duty cycle

For full forward 2000usec = 2msec pulse width is needed. So 2msec is 2 / 20 = 10% of the duty cycle

I wrote a python script that uses a loop

``````import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(6,GPIO.OUT)

pwm = GPIO.PWM(6, 550)
pwm.start(5)

try:

while True:
print ("t")

except KeyboardInterrupt:
pwm.stop()
GPIO.cleanup
``````

But nothing really happened. After running the script I counted with a voltmeter between M1 and M2 pins and was zero. Of course the Peltier didn't start.

EDIT 2

I tried to change the mode of `GPIO18` pin into ALT5 in order to enable the PWM circuit using the TimG's tool with the command

``````gpio_alt -p 18 -f 5
``````

And after that `gpio readall` returned:

`````` +-----+-----+---------+------+---+-Pi ZeroW-+---+------+---------+-----+-----+
| BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
|     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
|   2 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5v      |     |     |
|   3 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |
|   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 0 | IN   | TxD     | 15  | 14  |
|     |     |      0v |      |   |  9 || 10 | 1 | IN   | RxD     | 16  | 15  |
|  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | ALT5 | GPIO. 1 | 1   | 18  |
|  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
|  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
|     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
|  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
|   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
|  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
|     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
|   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
|   5 |  21 | GPIO.21 |   IN | 0 | 29 || 30 |   |      | 0v      |     |     |
|   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
|  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
|  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
|  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
|     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
+-----+-----+---------+------+---+-Pi ZeroW-+---+------+---------+-----+-----+
``````

Finally, I changed the python code and run it without any result again.

``````import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(18,GPIO.OUT)

pwm = GPIO.PWM(18,50)
pwm.start(10)

try:

while True:
print ("t")

except KeyboardInterrupt:
pwm.stop()
GPIO.cleanup
``````

Shouldn't I expect a voltage between M1 and M2 of the driver?

• Do you need the ability to pulse the Peltier? Or to reverse the hot/cold side? I have always just used a relay or transistor to turn the peltier on/off. But it depends on your use case. – Chad G Nov 8 '18 at 16:26
• The initial plan was to both turn on/off and as well as to alter the polarity of it to reverse hot/cold. For that reason, I bought also and an H-bridge to connect it after the driver. But then I thought to make it more simple and just turn it on/off at least in the beginning. – J. Doe Nov 8 '18 at 17:07
• Well that driver has an H bridge internal to it. Since it is capable of turning the motor either direction. You want to use the digital mode, not analog(the pi has no analog output) Although you could "fake it" by using pwm and a capacitor, might as well keep it all digital, you will have better control over it. From a quick look at the Docs, looks like S2 will control the polarity, and you can pulse S1 at different pulse lengths to get more/less current through the Peltier – Chad G Nov 8 '18 at 17:15
• So yes, I think it should all work, but I also thing that the driver is way overkill(and more expensive!) then using/building an on/off only H-bridge since you really dont need the precise control to pulse it, your software can easily turn it on/off every few seconds if you are trying to achieve a certain amount of cooling/heating. Motors need to be driven with a fast pulse to preserve torque while still having complete control over speed. That is not the case here. – Chad G Nov 8 '18 at 17:18
• I dont think that pin has PWM functionality. take a look here learn.adafruit.com/… – Chad G Nov 9 '18 at 21:18