Jump to content

Banner.jpg.b83b14cd4142fe10848741bb2a14c66b.jpg

Relays for Lesvedome


pmlogg

Recommended Posts

Alan

The diagram shows 12V+ going to clamp but that same connection going to DC+ on the relay board and + on the Encoder - so that would be +12V into it from the Lead Acid battery - so that's wrong; either I need 5V from another source, or with the buck converter added to the 12V circuit - as Hugh said.  The clamp is not an output but it is on the +12V line from the battery.

The solution you suggest is neat but is another draw on the 7Ah 12V battery rather than on the powerbank.  I could though wire the Hall switch, needing 6-36V, that way. 

I have to have the Raspberry Pi running as it performs the vital function of the wifi data link between the remote computer running Lesvedome to the VM110 through its usb cable.  So the VM110 will be getting 5V from it.  All along I had thought that the encoder, relay input signal, and Hall Effect switch would draw power from the powerbank, through the conduit of the Raspberry Pi and VM110, which I guess was wrong.  The thinking was to leave the 7Ah 12V battery just to power the motor via the relays - the main power draw. The connections that I've shown for the encoder were provided to me by another Lesvedome user, but re-reading that now I see his 5V + signal was not coming from the VM110 clamp but via another cable, source un-specified.  Reference was made to the Chris Harrow diagram showing a 560 Ohm resistor but that it might have been for a 12V supply. So an external source would seem to be needed for the Encoder and if the VM110 doesn't supply power to it

The Raspberry Pi will have at least 2 spare usb sockets, even if I used 2 to power the VM110.  Another solution would be to use one of those to provide 5V to the encoder, rather than adding the buck converter. 

Thanks

Peter

 

Link to comment
Share on other sites

Peter,

It was only after your last post that I realised you were using the Powerbank as well as the 7Ah lead acid. As the VM110 only requires about 70mA (from the manual) it can be easily powered from one raspberry pi USB connection. USB2 should be able to supply 500mA per output, and though the Raspberry Pi isn't capable of supplying that much current, I'm sure the 70mA will be no problem, so a clamp connection is not needed. A second USB output from the Pi could be used to power the rotary encoder as that needs around 20mA I think. You'll need to chop one end of the USB cable to get access to the 5V wires for the encoder power or use a USB breakout board if they exist.

Where are you getting the 5V to power the Raspberry Pi from. The powerbank 5V output? Rather than using a second USB lead from the Pi or a buck converter to power the encoder could it not be connected to the 5V powering the Pi.

If you want the 7Ah lead acid to power only the motor, the relay board 12V DC+/- connections (which power the relay coils) could then come from the Powerbank 12V output which could also power the hall effect switch.

It's best to connect the negative (Gnd) terminals of the powerbank and 7Ah lead acid together to avoid floating voltages though if the lead acid only goes to the relay board contacts to power the motor it's not strictly necessary as they are isolated from the rest of your circuitry.

Alan

Link to comment
Share on other sites

Allan

Yes, the 5V to go from powerbank via usb cable to the Pi then by usb cable to the VM110. 

The Powerbank has 2x 2.1A USB, 2x 1.0A USB, one x 2oV 3A and one 12V 2.5A.  The 20 and 12V have 2.5mm male power sockets.  There is no separate ground connector.  So the clamp could be disconnected, but the 12V connections would otherwise be as drawn before with the addition of 12V+ going to the Hall switch. 

I could use one of the other USB sockets of the Powerbank to directly power the encoder but I had planned on the connections from the rotary encoder and the Hall Switch coming together in a DB9 cable outside the enclosure for the VM110 + Pi + relay board and entering it by that single cable.  Similarly a single usb cable from the Powerbank, outside the enclosure (so I can take it indoors for charging), entering the enclosure going to the Pi.  Using a second USB socket using a chopped usb cable, all inside the enclosure would minimise cables in and out.  The final cables in and out would be the pair coming from the lead acid battery and the pair going to the motor.

If not going to clamp the +12V from the lead acid battery would just be going to two contacts on the relay board and to the Hall switch.

I've now drawn the whole system in less the indoor computer and the magnet to mark home position.  It looks a lot more complicated now but that is because of the addition of the two DPDT switches that isolate the existing Pulsar circuit board. When the switches are thrown the other way it's the new system that is isolated and the 'manual' system is on.  I was going

I hope that it all makes electronic and Lesvedome sense.

Thanks

Peter

DomeWiringDiag11.jpg

Link to comment
Share on other sites

Peter,

You're latest drawing and explanation is clearer now as you just want the one 5V USB cable coming from the powerbank. Your drawing looks like it will work OK as you want it to. :smile:

I'm not sure what the 10k resistor next to the hall effect is for as it's effectively just across the 12V lead acid battery. If it's to be used as a pull up for the hall effect switching signal it need to go between the brown and black wires of the switch. To check if a pull up is actually needed just power the VM110 via its USB socket and with no connection to a digital input pin measure the voltage on the pin with your multimeter. If it reads 5V as I'm sure it will, then the board has a pull up on each input anyway so an external one isn't necessary.

Also there is a connection just going between Dig Out3 to Dig In3. What purpose does this serve?

Alan

Link to comment
Share on other sites

Allan

Thanks for spotting that mistake with the resistor connections.  I did know the correct positioning but drew it incorrectly. I've now changed it. 

The Hall switch needs 6-36V.  When I first got it I tested it using 12V supply and no resistor. It did not produce a signal.  I then added the resistor and it worked. So, that's why I've drawn it in.  I will try it without and see. All the better if it can be left out.  The Dig Out3 to Dig In3 comes from other example circuits.  I don't really know what it is supposed to do.  I'll need to look back through emails etc. to see if I can find an explanation.  Again if I can get rid of it all the better.  I presume I need all of the 3 diodes shown.  I bought 10 so if needed elsewhere in the circuit they are available.

Once the relay board arrives next week I can get down to testing it.  The rest of the components I have already.

Thanks

Peter

  • Like 1
Link to comment
Share on other sites

Peter,

Yes, testing the hall effect switch on it's own and not connected to anything the pull up is required to measure an output change.

Hope it all  works OK when you try it out after the board has arrived. :smile:

I notice you haven't shown a fuse in the +12V line from the lead acid battery. If there is a wiring error or a fault, and the battery gets shorted you run the risk of something smoking and getting burnt. Lead acids can deliver very high currents, even a modest capacity one like you're using. Depending on the power of your dome motor its start up surge may blow a 10A quick blow fuse. A 10A antisurge fuse would be more robust, but it may need a 15A or similar fuse to stop it occasionally blowing on start up. A 15 or 20A fuse would be better than no fuse at all. :wink2:

Alan

Link to comment
Share on other sites

Allan

Thanks or that. I'll add an in-line fuse. Thinking about it there is one on the original Pulsar board - for just that reason. I can see what it's rating is. Luckily it's never blown as changing it would be awkward.

Thanks

Peter

  • Like 1
Link to comment
Share on other sites

Peter,

Just noticed re the pull up on the hall effect switch. Connecting the resistor between the hall effect power and its output would pull the output to 12V when the switch is 'off'. This would mean the VM110 digital i/p gets pulled up to 12V too which could cause problems as the board is 5V powered. If you do want an external pull up resistor it has to go between the switch output and +5V. Omitting the external pull up is the best option as the board is almost bound to have one on the digital inputs.

I didn't reply before, but you mentioned if the 3 diodes were necessary.

The diode between Dig Out2 and Dig In4 on the VM110 is there to protect Dig In4 from rising above 5V if Dig Out2 is pulled higher than 5V by the relay board. Whether the relay board IN- inputs rise  to 12V or 5V when the relay is off I don't know but it doesn't matter as the diode protects Dig In2 if it's 12V.

The diode going to relay board NO4 is actually reverse connected across the motor terminals if you follow the wiring. This is there to protect any circuitry from the back emf voltage spikes generated by the motor when it turns off. Not always necessary but it's good practice to have one.

The diode going to relay board DC+ is just circuit protection from accidentally connecting the lead acid battery the wrong way round.

None of the diodes are passing much current so standard 1N4001 diodes or similar would do.

Alan

Link to comment
Share on other sites

Alan

Thanks again.  A problem could be that the Hall Switch is rated as using input of 6-36V, that's why connecting to the 12V seemed to be a good idea.  But if the pull-up is not needed and the supply is 12V would not the signal still end up being 12V? Connecting a resister across the 5V line from the Powerbank would not be easy as it is delivered by a cable with USB connectors at both ends.  So, how to supply 6-36V without the signal in the board exceeding 5V?  Do I need a 5V rated Hall Switch or perhaps even a plain old Reed Switch?

Thanks

Peter

Link to comment
Share on other sites

Peter,

There's no problem with the hall switch being powered with 12V as the switch output is open collector. This is a diagram of the hall effect switch showing the 3 terminals

halleffectswitch.png.b163499685eba605b67ff3d35aacadf2.png

When the switch is off the output transistor is also turned off and its collector (pin 3) is effectively an open circuit. When the switch is on the transistor turns on (the collector to emitter junction becomes low resistance) and the output is effectively shorted to ground (pin 2). This is just how the reed switch operates when it is used instead of the hall effect switch. The digital inputs of the VM110 however want to see a change in voltage (0 or 5V), and not whether the input is shorted to ground or open circuit. The simplest way to achieve this is to connect a pull up resistor between the digital input pin and 5V. When the switch is off the digital input is pulled up to 5V by the resistor. When the switch is on the digital input is shorted to ground (0V) by the switch output transistor. The resistor can be a high value, 10k or more to avoid too much current drain on the 5V supply when the digital input is shorted to ground. If the switch was being used with a 3.3V logic board instead, the pull up resistor would just be connected to 3.3V. The pull up voltage is isolated from the hall switch power pin (pin 1) so it doesn't matter that the hall switch is powered from 12V.

Hope this makes it a bit clearer. As I mentioned before there will almost certainly be a pull up resistor already on the VM110 digital inputs, so you won't need to supply an external one as well. :smile:

Alan

Link to comment
Share on other sites

Alan and Gina

My Hall Switch claims to operate between 6 and 36V. So is not 5V too low for it (even taking out the resistor) and conversely 12V too high for Dig In 2?

Currently the only 5V into the system is from Powerbank to the Raspberr Pi, via usb.  Are you suggesting running a separate 5V (e.g. cut usbfor cable) for the Hall Switch? (but again that then falls below the 6V minimum. 

As an alternative could the circuit stay as now but add a buck converter - 12C to 5V-  on the black line, beween the switch and Digital Input 2?

Thanks

Peter

Link to comment
Share on other sites

Peter,

No, you've misread my last post. There is no problem in powering the hall switch from 12V just as you've drawn it. Leave that as it is. Remove the pull up resistor on its output from the diagram. It's not needed when the hall switch output is connected to the VM110 digital input and it's causing confusion. :smile:

As I mentioned above the hall switch output is not related to, or dependent on, the voltage used to power the hall switch. The voltage on the output is only dependent on the voltage supplied by a pull up resistor. When the switch output wire is connected to a VM110 digital input it is connected to a pull up resistor already mounted on the VM110 board digital input. The other end of this resistor will be connected to 5V.   Any voltage you then measure on the switch output  will only be 0V or 5V. The switch power pin sees 12V. The switch output pin sees 5V. Everybody's happy. :D

By the way, you can't use a buck converter to convert logic signal voltages from one value to another. If you wanted to convert a signal voltage to a lower voltage you'd just use 2 resistors as a potential divider.

Alan

Edited by symmetal
  • Like 1
Link to comment
Share on other sites

Hi Peter,

I have been away from this topic for a few days but it seems as if you are making good progress. One thing that occurs to me is that there seems to be a bit of confusion about the power supply of the VM110 board. The board is actually powered by the 5 volts from the incoming USB connection. The chip on the board that runs everything is a PIC18F family processor that actually runs at 3.3 volts. For reference, I have attached the construction instructions for the K8055n self-assembly board. This is actually identical to the VM110 board. The instructions include a circuit diagram for the board on page 15. This shows the 5 volt supply from the USB socket and the 3.3 volt regulator to supply the PIC chip. So the important thing to realise here is that you need to be sure that the Raspberry Pi that the VM110 is connected to via USB can supply sufficient current to run the VM110 board. I don't have any experience with RPis so I can't help you there.

Next is the confusing CLAMP connection on the VM110 board. This does NOT supply any power. It must be connected to the EXTERNAL +12 volts (or whatever voltage you are using) and it's function is to protect the ULN2803a chip against the high voltages that occur when an inductive load, such as a relay coil, is switched on and off.

The ULN2803a chip is a buffer/signal level shifter chip and the VM110 board uses two of them. One for the digital inputs, DI 1 to 8 and one for the digital outputs, DO1 to  8. I have attached the Texas Instruments datasheet for the ULN2803 chip and also a sketch showing how you need to connect the digital outputs. Basically, the digital outputs are like electronic switches. One side of the switch is connected to ground and the other side is connected to the appropriate Digital Output terminal. The thing that you are switching on or off (relay coil or whatever) has one side connected to the DO terminal and the other to the EXTERNAL positive voltage supply. This can be any voltage up to 50 VDC. When the switch 'closes' there is a low resistance path for current to flow from the positive supply, through the load and then to ground. So, for your case, the relay coil becomes energised. When the switch is 'open' there is no path to ground so the coil doesn't become energised. Actually there is a very high resistance path and a microamp or two does flow through the load but nothing like enough to energise the relay coil. As I said in an earlier post, the current through the each of the loads being driven by the chip can be up to 500 milliamps - subject to a total of 2.5 amps at any one time .

HTH

Regards, Hugh

k8055n_Schematic.pdf uln2803a.pdf ULN2803a Darlington.pdf

  • Like 1
Link to comment
Share on other sites

Hi Hugh,

Thanks for the schematic. That explains why the clamp terminal is called that. :smile: None of the digital outputs are driving the relay coils or any inductive loads directly so the clamp connection isn't necessary, but no harm in connecting it to the relay board 12V.

The pull up resistors to 5V on the digital inputs will put Peter's mind at rest too concerning the hall effect switch.

Alan

Link to comment
Share on other sites

Hugh and Alan

Thanks for that extra guidance on the VM110 and connections.  I think it has all sunk in now. 

While waiting for the relay to arrive I've been concentrating on putting together the box which houses the Bourns encoder and incorporates the Hall Effect switch; also making a mount for the home position magnet (going to try that first but can change if not accurate enough.  The relay didn't arrive until 9p.m. last night - other commitments mean I probably won't be able to do trial wiring etc. until next week. 

Thanks

Peter

Link to comment
Share on other sites

Hi Peter,

I've been looking at your 'final' schematic again and I think you MAY need to add pull-up resistors to make it function in the way you need.

A bit of background. The digital outputs from the VM110 are 'open collector' outputs. When they are switched ON by the Lesvedome software, the output terminal is connected via a LOW resistance to ground. When they are OFF, they are still connected to ground but this time via a very high resistance.  What you need is a way to convert this resistance change into a voltage change to operate your relay board. You get the necessary voltage change by using a 'pull-up' resistor connected beween the digital output terminal and the positive supply. When the resistor is in place, when the DO is OFF, it's potential is pulled up to the same as the positive supply. However, when it turns ON, the voltage at the output terminal drops to very close to zero as there is a low resistance path to ground. The combination of the pull-up resistor, say 5000 ohms and the on-state low resistance, say 1 ohm make up a voltage divider of total resistance 5000 + 1 ohms. In the on state, the output voltage is 0nly 1/5001th of the positive supply voltage.

The reason I say you MAY need to add a couple of pull-up resistors is that the relay board MAY already include these resistors. The relay board uses optical isolators so the input circuit is something like this:

image.png.518e41397322c2c8b8be21d19b8122e4.png 

Please note - this is just my guess and it might be wrong. However, if it is like this then you already have a suitable resistor, the one I have called Rd. To make this circuit work, as well as connecting the IN- terminals to the Velleman digital outputs, you will need to connect the relay board IN+ terminals to your +12 volt supply. Then when the software switches the Velleman output to ON, current can flow through the light emitting diode in the optoisolator on the relay board. This triggers the matching phototransistor and activates the relay coil. Bingo!! There is one other assumption here - that the DC supply to the Velleman board and to your relay board share a common ground. I am sure this is the case so this will work.

I am sorry if this is too confusing but I think you will need to experiment - if the relay board comes with a schematic then you can easily see what you need to do. If not you may have to experiment. In the latter case, I strongly suggest that you NEVER connect the positive line 12 volt supply directly to the IN+ relay terminals. Always use a resistor in series with a value of between 1000 and 10000 ohms. (Because if the resistor I called Rd doesn't exist you would immediately burn out the photodiode in the optoisolator)

Regards, Hugh

  • Like 1
Link to comment
Share on other sites

Hi Hugh,

Good point. I was assuming the relay board acted similar to the ELK-924 relay board but that may not be the case. If the relay board input + and - do just go to an opto isolator then what you describe would need to be incorporated into the design. Hopefully some application notes or a circuit diagram came with the board and Peter can let us know what's what. The Grounds of the Velleman and relay board are connected so that's OK.

Alan

Link to comment
Share on other sites

The specifications of the relay board on the Amazon site does state

------------------------------

Features:
4-channel, DC 12V 30A relay module.
Output capacity: within DC 30V 30A or AC 250V 30A.
Using optocoupler isolation, strong anti-jamming capability and stable performance.
The module can be set high or low trigger.
To ensure stability, uses industrial grade PCB board and 9.5mm barrier terminals.
All interfaces can be connected directly via terminal wiring leads, very convenient.

Module Interface Description:
1. DC +: DC power supply positive;
2. DC -: DC power supply module negative;
3. IN: Signal input terminal(support High/Low Level switch freely);
4. Normally open (NO): Relay normally open;
5. Common terminal (COM): Relay common;
6. Normally closed terminal (NC): relay normally closed terminal;

Specifications:
Type: 4-Channel
Relay Voltage: DC 12V 
Output Capacity: within DC 30V 30A or AC 250V 30A
Quiescent Current: 5mA 
Trigger Current: 5mA  
Module Size: 128 * 68 * 20mm
Module Weight: 177g

------------------------------------

To test just connect 12V to the relay board DC+ and DC - terminals and just connect one of the relay IN- terminals to the DC- terminal (which is the ground). If you hear a relay click when you do and click again when you remove the connection to IN- then it's working as we assumed and no changes need to be made.

Alan

Edited by symmetal
Link to comment
Share on other sites

Hugh and Alan

Thanks for that. 

I'm away in the Highlands for the weekend (no clear night sky in case you wondered) but when I get home tomorrow I will try that on the relay board to see what happens.  I do have a pack of resistors should I need them but hopefully not as so far it just three few diodes that are in the way of simple terminal to terminal connections.  I have a small project board to mount them onto for connection into the circuit.

Thanks, Peter

Link to comment
Share on other sites

Hugh and Alan

Unfortunately no documentation came with the relay.  Last evening I tried what was suggested.  An LED illuminated on the relay board but no clicks.  I measured voltage across the relay's outputs and did not get anything.

When adding the resistor, do I need to add one on the line into each IN+ connection i.e. 3 resistors in total, or could it be in series before splitting off to the 3 relays?

I've done another version of the wiring diagram, leaving off the pull-up resistor for the Hall Effect Switch, adding the fuse on the 12V+ line from the battery and adding 12V+ lines into the 3 relays, but with one resistor as above.  How does that look?

Thanks

Peter

 

0419DomeWiringDiag15.jpg

Link to comment
Share on other sites

Hi Peter,

I think one resistor will be fine - perhaps Alan could confirm that?

Do you have a multimeter with an ohms range? If you do, you can check to see if there is a suitable resistor already fitted on the relay board. With the board not connected to anything else, measure the resistance between IN1+ and IN1- with the red multimeter lead connected to IN1+. Then swap the meter leads over and measure again. If one reading is a few thousand ohms and the other very high then there is a suitable resistor on the relay board and you don't need an external one. Just connect all the IN+ terminals to your 12 volt supply.

If you don't have a multimeter I do recommend you get one - it will be really useful when you build your dome driver. This one from Amazon looks OK  and not too expensive.

https://www.amazon.co.uk/Pocket-Digital-Multimeter-Ranging-Multimeters/dp/B015Z451ZY/ref=sr_1_9?crid=2TO2WULPN4THF&keywords=multimeter+tester&qid=1558353050&s=gateway&sprefix=multimeter%2Caps%2C188&sr=8-9

HTH,

Regards, Hugh

Link to comment
Share on other sites

Hugh

Thanks for that.  I do have a multimeter, in fact I've just bought a new one as the continuity switch position on my old one has become intermittent.  I will give that measurement a try tonight.

Thanks

Peter

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.