LEM LTSR 15-NP and more
Moderator: Benj
LEM LTSR 15-NP and more
I have made a flowchart for an engine control. Till now everything works fine in hardware but I also know this flowchart can be better made. For me is programming the flowchart always a difficult thing to do
This project is a safety road sign board. See attached picture.
The original PCB was burned out so I had to make a new one. But I have some questions
Situation:
• DC motor 12V
• Two limit switches (up and down) – Active LOW
• Remote control with four switches – Active HIGH
• Two relays for switching the engine right and left turn
• One relay for measuring the used power through a LEM LTSR 15-NP. This LEM is hardware configured for 7.5A. This LEM is used to stop the motor when it is using more than 7.5A in case of the limit switches are not working or other problems. In both turn directions.
The LEM is supposed to give 2.5V (Nominal Output Voltage) when the 7.5A is reached. This voltage goes through a TL082CP (Operational Amplifier) and then to PIN RA5 from the PIC16F1788.
I don’t have any experience with ADC configuration on a PIC. I hope someone can help me with this.
The motor must be stopped when the 2.5V is reached under all circumstances.
Other information:
The critical part on this PCB is RL2 and RL3. The must be switched at the same time otherwise there will be a short. In an next updated version of this PCB I will make use of a MOSFET H-Bridge in this case.
Attached pictures are a part of the PCB with the relays and the LEM and the new PCB.
Attached is also the flowchart what I have made.
This is how the basics are working:
https://youtu.be/bYipUoFUdfc
-
This project is a safety road sign board. See attached picture.
The original PCB was burned out so I had to make a new one. But I have some questions
Situation:
• DC motor 12V
• Two limit switches (up and down) – Active LOW
• Remote control with four switches – Active HIGH
• Two relays for switching the engine right and left turn
• One relay for measuring the used power through a LEM LTSR 15-NP. This LEM is hardware configured for 7.5A. This LEM is used to stop the motor when it is using more than 7.5A in case of the limit switches are not working or other problems. In both turn directions.
The LEM is supposed to give 2.5V (Nominal Output Voltage) when the 7.5A is reached. This voltage goes through a TL082CP (Operational Amplifier) and then to PIN RA5 from the PIC16F1788.
I don’t have any experience with ADC configuration on a PIC. I hope someone can help me with this.
The motor must be stopped when the 2.5V is reached under all circumstances.
Other information:
The critical part on this PCB is RL2 and RL3. The must be switched at the same time otherwise there will be a short. In an next updated version of this PCB I will make use of a MOSFET H-Bridge in this case.
Attached pictures are a part of the PCB with the relays and the LEM and the new PCB.
Attached is also the flowchart what I have made.
This is how the basics are working:
https://youtu.be/bYipUoFUdfc
-
-
- Posts: 362
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 45 times
- Been thanked: 62 times
- Contact:
Re: LEM LTSR 15-NP and more
Hello Frank607
If you search this forum by using key-words "current sense"
you can find some good info.
One good post (by Benj) :
viewtopic.php?f=26&t=4849&p=101459&hili ... se#p101459
If you search this forum by using key-words "current sense"
you can find some good info.
One good post (by Benj) :
viewtopic.php?f=26&t=4849&p=101459&hili ... se#p101459
-
- Posts: 362
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 45 times
- Been thanked: 62 times
- Contact:
Re: LEM LTSR 15-NP and more
Hello Frank607
A few words about the relationship of volts and amps in the current sensor output.
You wrote:
The LEM is supposed to give 2.5V (Nominal Output Voltage) when the 7.5A is reached...
I think you are wrong.
Have a look at the diagram below.
Volts = 0v to 2.5v shows negative amps.
Volts from 2.5 to 4.5 shows positive amp.s
2.5v = 0A.
I will use example of 20A ACS712.
The positive amps zone is on the right side.
If sensor Vout = 2.5v, Iout = 0A.
If sensor Vout = 3+v, Iout = 3+A.
If sensor Vout =4.5v, Iout = 10A.
-------------------------------------------
You have to use integer (1024).
If half of integer = 512, Vout = 2.5v, Iout = 0A.
If integer readings = 1024, Vout = 4.5V, Iout = 10A.
-------------------------
You need to do some calculations in you code.
A good idea to do some calibration of your sensor
before you run a main loop.
-------------------------
What I am saying is: please spend some time with
some kind of simulation of your sensor.
Use pot or any good power supply and slowly increase
voltage from 2.5v to 4.5v and see the results in your
hardware display(or anything like LED). If your code works OK the LED will flash at 7.5A
(if you use LED as some kind of indication of I=max from one of micro controller
output).
---------------------
If your power supply unit will supply micro controller with 5.1v instead of 5v the resulting
amps will be a bit different.
Please pay attention to this sensor...
A few words about the relationship of volts and amps in the current sensor output.
You wrote:
The LEM is supposed to give 2.5V (Nominal Output Voltage) when the 7.5A is reached...
I think you are wrong.
Have a look at the diagram below.
Volts = 0v to 2.5v shows negative amps.
Volts from 2.5 to 4.5 shows positive amp.s
2.5v = 0A.
I will use example of 20A ACS712.
The positive amps zone is on the right side.
If sensor Vout = 2.5v, Iout = 0A.
If sensor Vout = 3+v, Iout = 3+A.
If sensor Vout =4.5v, Iout = 10A.
-------------------------------------------
You have to use integer (1024).
If half of integer = 512, Vout = 2.5v, Iout = 0A.
If integer readings = 1024, Vout = 4.5V, Iout = 10A.
-------------------------
You need to do some calculations in you code.
A good idea to do some calibration of your sensor
before you run a main loop.
-------------------------
What I am saying is: please spend some time with
some kind of simulation of your sensor.
Use pot or any good power supply and slowly increase
voltage from 2.5v to 4.5v and see the results in your
hardware display(or anything like LED). If your code works OK the LED will flash at 7.5A
(if you use LED as some kind of indication of I=max from one of micro controller
output).
---------------------
If your power supply unit will supply micro controller with 5.1v instead of 5v the resulting
amps will be a bit different.
Please pay attention to this sensor...
- Attachments
-
- s20A_Volts_vs_Amps-2.jpg (61.07 KiB) Viewed 47444 times
-
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
Re: LEM LTSR 15-NP and more
Hello,
The output depends on how you have connected the pins - to select the current range of the device
There is a formula for the output they give 2.5 Volts out at ZERO Current
Example
ip = 250 Amp (This is the overload rating of the device)
ipn current messuring range (see Nominal RMS Current selection )
Vout = 2.5 + ( 0.625 * 250 / 7.5)
Hope this helps
Steve
The output depends on how you have connected the pins - to select the current range of the device
There is a formula for the output they give 2.5 Volts out at ZERO Current
Example
ip = 250 Amp (This is the overload rating of the device)
ipn current messuring range (see Nominal RMS Current selection )
Vout = 2.5 + ( 0.625 * 250 / 7.5)
Hope this helps
Steve
Success always occurs in private and failure in full view.
Re: LEM LTSR 15-NP and more
Today I’m going to work further about this project. First of all I must solve the following problem but I don’t know how to work around the Limit Switches.
If Limit_Switch_UP is pressed , I can’t get the frame Down because the Relays are switched Off. The same is for the other way.
How do I get this to work ?
More info:
Off course, when Limit_Switch_UP is pressed there must be no way to activate UP because it can’t go (mechanical) further. Only when Limit_Switch_UP is released the UP Switches must be working till the Limit_Switch_UP is again pressed.
The same in the other way.
Attached is what I have now.
If Limit_Switch_UP is pressed , I can’t get the frame Down because the Relays are switched Off. The same is for the other way.
How do I get this to work ?
More info:
Off course, when Limit_Switch_UP is pressed there must be no way to activate UP because it can’t go (mechanical) further. Only when Limit_Switch_UP is released the UP Switches must be working till the Limit_Switch_UP is again pressed.
The same in the other way.
Attached is what I have now.
Re: LEM LTSR 15-NP and more
For the LEM. Is a good idea to start with this topic?
https://matrixtsl.com/mmforums/viewtopi ... =29&t=9939
https://matrixtsl.com/mmforums/viewtopi ... =29&t=9939
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: LEM LTSR 15-NP and more
Hi, Frank.
Regarding the Link to John Crows project.
I have used the ACS723 before.
I still have the -5A to + 5A version.
For that, the formula I use is:
If you are using the -10 +10 version (part number ACS723LLCTR-10AB-T) then the formula to use is:
Float ADC just means the ADC is read and typecast to a float type, instead of an integer.
For this to work the Variable Current must be a float type.
You don't have to worry about span etc.
If you are interested in how I worked out the formula, it's fairly involved, but I can post it, just let me know.
The issue I can think of is excessive current on the motor initial start-up since the rota will be stationary.
So if your hardware is too quick to act, it will cut off the power to the motor, when it first starts up.
ACS723 should be ok in theory as it does state it's for motor control.
Hope this helps
Regarding the Link to John Crows project.
I have used the ACS723 before.
I still have the -5A to + 5A version.
For that, the formula I use is:
Code: Select all
Current = 12.5/1024.0 * (Float ADC-512)
Code: Select all
Current = 25/1024.0 * (Float ADC - 512)
For this to work the Variable Current must be a float type.
You don't have to worry about span etc.
If you are interested in how I worked out the formula, it's fairly involved, but I can post it, just let me know.
The issue I can think of is excessive current on the motor initial start-up since the rota will be stationary.
So if your hardware is too quick to act, it will cut off the power to the motor, when it first starts up.
ACS723 should be ok in theory as it does state it's for motor control.
Hope this helps
Martin
-
- Posts: 362
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 45 times
- Been thanked: 62 times
- Contact:
Re: LEM LTSR 15-NP and more
Hello Frank
Can you tell more about your safety sign operation?
What are the states of the system?
When your sign suppose to be rotated or moved?
--------------------
Re: switches and H-Bridge.
Please have a look at my gate project:
http://www.geocities.ws/viktor_au/proje ... oller.html
------------------
It is a very simple system with two end-switches, motor, H-bridge and Arduino.
It works without major problems.
Can you tell more about your safety sign operation?
What are the states of the system?
When your sign suppose to be rotated or moved?
--------------------
Re: switches and H-Bridge.
Please have a look at my gate project:
http://www.geocities.ws/viktor_au/proje ... oller.html
------------------
It is a very simple system with two end-switches, motor, H-bridge and Arduino.
It works without major problems.
Re: LEM LTSR 15-NP and more
Hi viktor_au, I have looked for a H-bridge for the motor driver. But on the time that I must make a PCB for this frame I kept to stay on the old PCB because this was working for more than ten years.
The updated version will be with a H-bridge. Thanks for your information and your nice webpage. !
I have made a test PCB some two weeks ago with a H-bride according to this website:
https://www.instructables.com/H-Bridge- ... or-Driver/
I have received this test PCB last Monday. So I need to find some time to fill this with PB with components and to test it.
But for now I have an almost working PCB as you can see in the YouTube video. (see my first post)
Also @Martin. Today I have worked only on the hardware of this frame. Tomorrow I will go further with the software and try to understand what you have written.
Frank
The updated version will be with a H-bridge. Thanks for your information and your nice webpage. !
I have made a test PCB some two weeks ago with a H-bride according to this website:
https://www.instructables.com/H-Bridge- ... or-Driver/
I have received this test PCB last Monday. So I need to find some time to fill this with PB with components and to test it.
But for now I have an almost working PCB as you can see in the YouTube video. (see my first post)
Also @Martin. Today I have worked only on the hardware of this frame. Tomorrow I will go further with the software and try to understand what you have written.
Frank
Re: LEM LTSR 15-NP and more
@Martin and viktor_au
I’m still here but I don’t have time now. I really appreciate your help and I want to finish this project as soon as possible. But time is the problem
I’m working on three different projects now. I hope you both can understand this.
This LEM is new to me , so this will be a maybe a problem for me.
I have also a question to my .fcfx file what I have posted above. Is this the right way to do this or can it be easier or simpler ?
Frank
I’m still here but I don’t have time now. I really appreciate your help and I want to finish this project as soon as possible. But time is the problem
I’m working on three different projects now. I hope you both can understand this.
This LEM is new to me , so this will be a maybe a problem for me.
I have also a question to my .fcfx file what I have posted above. Is this the right way to do this or can it be easier or simpler ?
Frank
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: LEM LTSR 15-NP and more
Hi, Frank.
If it was me, I would use the state machine approach where each number state would call a function.
If it was me, I would use the state machine approach where each number state would call a function.
Martin
Re: LEM LTSR 15-NP and more
To test this LEM I have made a breadboard with components.
These components are exactly the same as I have on my PCB
The yellow unconnected wire is used to connect a LAB power supply for simulation of the LEM. (output in volts)
There is also an LED to see if the 4.8V is reached.
I have also made a FlowCode project to test this. But I don’t know how to make the calculations.
Hopefully someone can show me the right direction to do this.
Thanks.
These components are exactly the same as I have on my PCB
The yellow unconnected wire is used to connect a LAB power supply for simulation of the LEM. (output in volts)
There is also an LED to see if the 4.8V is reached.
I have also made a FlowCode project to test this. But I don’t know how to make the calculations.
Hopefully someone can show me the right direction to do this.
Thanks.
- Attachments
-
- 01 - Test LEM 15.fcfx
- (8.32 KiB) Downloaded 201 times
-
- 2021-08-24 14.34.25 - AD - 1024.jpg (84.08 KiB) Viewed 47017 times
Re: LEM LTSR 15-NP and more
Hi viktor_au,
I have compiled your code to a hex file.
I get this warning:
If I load the hex file in the chip and put power on the chip the LED goes immediately on and stays on. I have not connected any power supply to the An4 pin.
If I connect a power supply to the An4 pin and turn it to 5V nothing happens
Frank
I have compiled your code to a hex file.
I get this warning:
Code: Select all
04_lem.c: FCM_StrToNum()
594: MX_CHAR FCL_STR_CHAR[1] = ".";
^ (340) string not terminated by null character (warning)
If I connect a power supply to the An4 pin and turn it to 5V nothing happens
Frank
-
- Posts: 362
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 45 times
- Been thanked: 62 times
- Contact:
Re: LEM LTSR 15-NP and more
The input pin for ADC is An0, not An4.
You can change it if you want.
-------------------
Test now with two hex files.
One will have the fixed value of CurrMax < 480. LED should be Off.
Another will have the fixed value of CurrMax > 490. LED should be On.
------------------
You can change it if you want.
-------------------
Test now with two hex files.
One will have the fixed value of CurrMax < 480. LED should be Off.
Another will have the fixed value of CurrMax > 490. LED should be On.
------------------
Last edited by viktor_au on Thu Sep 02, 2021 10:37 pm, edited 1 time in total.
-
- Posts: 362
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 45 times
- Been thanked: 62 times
- Contact:
Re: LEM LTSR 15-NP and more
OK.
Let make another step back- check the one second LED blink test.
PS
Check your hardware connections if it doesn't work.
Is LED connected to C4?
Let make another step back- check the one second LED blink test.
PS
Check your hardware connections if it doesn't work.
Is LED connected to C4?
Last edited by viktor_au on Thu Sep 02, 2021 10:37 pm, edited 1 time in total.
Re: LEM LTSR 15-NP and more
Hi viktor_au,
I had made a stupid wiring mistake with the 3.3v and 5V power supply to led. Now the led_blink is working I’m really sorry that I didn’t see this earlier.
I have tested your files:
04_lem.fcfx: The led goes immediately on. I have not connected any wire from the LAB power supply to the An4 pin. Even when I connect An4 to the power supply and turn the voltage from 3 to 5.2V the LED stays on.
curr_max_above_490.fcfx: The LED goes on.
curr_max_less_470.fcfx: The led goes on for a short time (±250ms) and goes off.
I had made a stupid wiring mistake with the 3.3v and 5V power supply to led. Now the led_blink is working I’m really sorry that I didn’t see this earlier.
I have tested your files:
04_lem.fcfx: The led goes immediately on. I have not connected any wire from the LAB power supply to the An4 pin. Even when I connect An4 to the power supply and turn the voltage from 3 to 5.2V the LED stays on.
curr_max_above_490.fcfx: The LED goes on.
curr_max_less_470.fcfx: The led goes on for a short time (±250ms) and goes off.
-
- Posts: 362
- Joined: Fri Jan 26, 2018 12:30 pm
- Location: South Australia
- Has thanked: 45 times
- Been thanked: 62 times
- Contact:
Re: LEM LTSR 15-NP and more
Hello Frank
About mistakes.
It is part of our life, isn't it?
We all make mistakes. Don't apologise. No need.
--------------------
You wrote about file:
curr_max_less_470.fcfx: The led goes on for a short time (±250ms) and goes off.
---------------
Please have a look at the flowcode chart.
Check the part above the main loop.
----------------
led_curr_max -> On
100mS delay.
led_curr_max -> Off
--------------------
It is normal.
This short blink indicates that your MC started to work.
----------------------
Note: I am not sure what resistor do you use to limit the LED current.
I used 5v without any problems with the limiting resistor.
Check the online calculator to find out the resistor value.
https://www.digikey.com.au/en/resources ... s-resistor
------------------------------------------
I have attached the file: test_A0.
--------------------
Connect the lab power supply to A0.
Power your board.
Slowly increase the lab power supply voltage from 0v to +5v.
Pay attention to voltage close and above 4.8v (less than 5v.)
Will LED turn On at 4.8v or close to this value?
If it doesn't, check your power supply to your PIC. Is it correct?
-------------------
Note:
I didn't use PIC MC for a long time (work with Arduino now).
I don't know the analog input of your chip parameters.
I think it should be OK if you won't apply to An0 voltage above 5v.
About mistakes.
It is part of our life, isn't it?
We all make mistakes. Don't apologise. No need.
--------------------
You wrote about file:
curr_max_less_470.fcfx: The led goes on for a short time (±250ms) and goes off.
---------------
Please have a look at the flowcode chart.
Check the part above the main loop.
----------------
led_curr_max -> On
100mS delay.
led_curr_max -> Off
--------------------
It is normal.
This short blink indicates that your MC started to work.
----------------------
Note: I am not sure what resistor do you use to limit the LED current.
I used 5v without any problems with the limiting resistor.
Check the online calculator to find out the resistor value.
https://www.digikey.com.au/en/resources ... s-resistor
------------------------------------------
I have attached the file: test_A0.
--------------------
Connect the lab power supply to A0.
Power your board.
Slowly increase the lab power supply voltage from 0v to +5v.
Pay attention to voltage close and above 4.8v (less than 5v.)
Will LED turn On at 4.8v or close to this value?
If it doesn't, check your power supply to your PIC. Is it correct?
-------------------
Note:
I didn't use PIC MC for a long time (work with Arduino now).
I don't know the analog input of your chip parameters.
I think it should be OK if you won't apply to An0 voltage above 5v.
Last edited by viktor_au on Thu Sep 02, 2021 10:38 pm, edited 1 time in total.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: LEM LTSR 15-NP and more
Hi Frank,
If you are interested I'm creating a LTSR component for both V8 and V9.
The v8 version looks likes this: It should be ready today.
It even simulates for you.
Simulation V9 version: Note: selected 6A version for V8 as that is as far as I have got at the time of writing.
If you are interested I'm creating a LTSR component for both V8 and V9.
The v8 version looks likes this: It should be ready today.
It even simulates for you.
Simulation V9 version: Note: selected 6A version for V8 as that is as far as I have got at the time of writing.
Martin