Shop OBEX P1 Docs P2 Docs Learn Events
Working on a new project at my job...> change a value on the fly — Parallax Forums

Working on a new project at my job...> change a value on the fly

sam_sam_samsam_sam_sam Posts: 2,286
edited 2014-09-21 18:50 in General Discussion
This Post has been Solved for now

I know it been a while from the last time I did a project But

Let me start at the being

I start this new job at a new company about a 1 1/2 ago when I had the job interview the boss ask me about a beam saw that we have that did not work that had been sitting there for about two years that the last manitance man could not get it to work the right way

Could I get this saw to work the way it should and if I could get it to work he would buy me lunch

Here what was wrong with it

One broken encoder belt
One bad proportioning valve amplifier
Had wiring hook up wrong

Cutting arm would jump up and down

It took about 2 month for me to get this beam saw to work the right way about 80% there where still some thing that would not work right but it would work enough to use to cut beam and plates and pipe so my boss bought me lunch

But it would work a few month then I would have to re adj the proportioning valve amplifier then it work agian this would keep happing
that was ok but it would take two or three hour each time this need to be done

About two month ago it came up on the computer screen it said BAD SRAM call the tech support for help so I did so put a new SRAM chip in it then it would not always boot to the right screen so i call tech support again was told that I should replace the EROM chip well this did not help very much still would do the same thing but this not the only problem
the cutting arm would not come down at all or would come down fast with out any control of it

There are seven boards in this computer stack
The computer board is $600.00
The board that controls the proportioning valve amplifier and reads the two pressure sensor
This board is $400.00
One board controls the computer screen
This cost is unknow

Tech support can not tell me which board or boards are bad
I could send all seven to be look at

$100.00 to look at them
$68.00 an hour
They have no idea how much time this will take

Or I could have one of there tech come out and look at it but here is the problem with this
frist you have to buy a plane ticket from where they are
then you have to pay $ 140.00 a day for food and hotel room from one to two day
then you have to pay $130.00 hour and you have to pay for 4 hour

It time for a Basic Stamp Beam Saw Controller for the cutting arm


' {$STAMP BS2}
' {$PBASIC 2.5}

Green_Led PIN 0
Rate_Value PIN 4
Force_Value PIN 7
temp VAR Byte
laps VAR Byte

run:
DO
HIGH 0
temp = 76
'247 makes the value closed
PWM Rate_Value , temp, 05
'076
'075
'074
'073
temp = 131
PWM Force_Value , temp, 05
'165 makes the arm go UP
'136 makes the arm stop
'134 makes the arm move
'132
'130
LOW 0
LOOP

Here how I am doing this I am using a 2.2K ohm resister and a 22uf cap on the Basic Stamp I/O PWM pins that gose to the proportional valve amplifier

Here is what I want to is to be able to change this temp = a value that is need I do not know if I want use a POT or a encoder switch

I am not sure where to start with this dose anyone have any ideas
«1

Comments

  • kwinnkwinn Posts: 8,697
    edited 2013-07-03 20:19
    An encoder switch would be simpler since it needs only 2 digital input pins. A pot would need an ADC and at least 2 I/O pins. When the program starts set temp to a reasonable default value and have the encoder increment or decrement the value from there.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 08:20
    kwinn

    Thank you for your reply

    I was thinking about doing some thing like this
    Here is my problem with doing this way is what type of encoder wheel should I use this what I want to know

    How many dark and white spaces for one complete revolution on the encoder disk?

    The arm gose down at a rate of about1/4 to 1/2 inch in a minute or so
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 08:56
    kwinn wrote: »
    When the program starts set temp to a reasonable default value
    I know what these values are for each valve
    kwinn wrote: »
    and have the encoder increment or decrement the value from there.

    I have these values as well

    Here is the lowest value to the the highest and only use this range

    FOR temp = 73 TO 75 STEP 1 ' for closing the valve
    PWM Green_Led , temp, 5
    NEXT

    Other code here

    FOR temp = 75 TO 73 STEP 1 ' for opening the valve
    PWM Green_Led , temp, 5
    NEXT


    I could use this or is there a beter way of doing this
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-07-04 09:12
    It looks like you are doing major surgery on this device, and it is a long term porject, and the powers that be have determined its eadsiwer and cheaper to hack it than to just replace it with a new one.

    If this is the case, may I suggest all or some of:

    * Determine exactly what each board is supposed to perform.
    * Determinte exactly what sensors and actuators are present
    * Create drivers for the sensors and actuators (using the old circuit is possible, or using a new circuit is possible, which ever works first)
    * Do the final application on a prop. You and you boss will know exactly whats going on, it would be easier to maintain.

    It would be quicker in the long run to start at the top and do the analysin up front before you start changing stuff, rather than as you try to fix each parts, as you fixes may cause furhter errors someplace else.

    Of course, it would be quicker to just spend the $$$ and get a new machine.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 09:34
    Thank you for your reply
    It looks like you are doing major surgery on this device, and it is a long term porject, and the powers that be have determined its eadsiwer and cheaper to hack it than to just replace it with a new one.

    If this is the case, may I suggest all or some of:

    * Determine exactly what each board is supposed to perform.
    * Determinte exactly what sensors and actuators are present
    * Create drivers for the sensors and actuators (using the old circuit is possible, or using a new circuit is possible, which ever works first)
    * Do the final application on a prop. You and you boss will know exactly whats going on, it would be easier to maintain..

    " * Do the final application on a prop." I would do this with a prop if I knew more on how to write code for it

    I have the beam saw working now with a Basic Stamp as the arm contoller I just need to write the code to adj the speed of the cutting arm by the user
    It would be quicker in the long run to start at the top and do the analysin up front before you start changing stuff, rather than as you try to fix each parts, as you fixes may cause furhter errors someplace else.

    Of course, it would be quicker to just spend the $$$ and get a new machine.

    " just replace it with a new one." This will not happen
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-07-04 10:02
    " just replace it with a new one." This will not happen

    You are in a very luck position. You get a cool project, and somebody else will pay for it.

    If this input is helpful, I'll continue until you tell me to stop.

    Whether you write new driver and application, whether you use BS2 or prop, the most important first step is to understand what each piece is doing. It might seems like a waste of time, but know that every minute you spend NOW save you an hour (minimum) later.

    What you might want to look into is a "two pronged analysis": start at the highest level and describe what the device does; and start at the lowest level and describe what each input and output does. Work down through the user interface and up through the hardware drivers. When these meet in the middle, anybody could write code on any hardware to run the tool, and you are ready to start. NOTE: if you start earlier, only about 1/2 to 1/10 of your work will be useful, due to dead ends and false starts until you complete your understanding of the system.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-07-04 10:23
    I think kwinn was referring to this type of encoder. SparkFun also sells encoders; this one has a push button built in.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 11:57
    What you might want to look into is a "two pronged analysis": start at the highest level and describe what the device does; and start at the lowest level and describe what each input and output does. Work down through the user interface and up through the hardware drivers. When these meet in the middle, anybody could write code on any hardware to run the tool, and you are ready to start. NOTE: if you start earlier, only about 1/2 to 1/10 of your work will be useful, due to dead ends and false starts until you complete your understanding of the system.

    I like your idea but I have a problem the company that make this saw will only tell me so much of what each board is and what it dose this why I have make my own boards and hardware for this project

    This saw has an auto setting that messure the item to be cut and cut as many as you need but are too many thing wrong at this point to get this part to work the way it should work and right now we do not use part of the saw right now and way
    They want you send them the computer stack boards for them to be fix at his point int he game
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2013-07-04 12:32
    Sam,
    Is it possible that you could use DIP switches?
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 12:35
    Yes it would be
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2013-07-04 12:46
    8 switches = 8 bits = 0 to 255

    Looks like you PWM a pin for a while, then it could break away and read the DIPs and go on...

    So, there will always be a brief period where the PWM pin is idle (as long as it takes to read the DIPs)
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-07-04 12:50
    PJ Allen wrote: »
    So, there will always be a brief period where the PWM pin is idle (as long as it takes to read the DIPs)

    Are there two pins that need a PWM signal? Rate and force? Or is only one signal needed at a time?
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 12:59
    NOTE: if you start earlier, only about 1/2 to 1/10 of your work will be useful, due to dead ends and false starts until you complete your understanding of the system.

    Here is how this saw works for the cutting arm

    The Force_Value works like this with no power to the coil the cutting arm falls very fast
    If you put power to the coil will open the valve
    If you put to a little to much power to the coil then the cutting arm gose UP
    If you full power to the coil then the cutting arm gose UP very fast

    The Rate_Value work like this with no power to the coil the cutting arm fall
    If you put power to this coil you are closing the valve which is how you control how fast the cutting arm fall
    If you put full power to the coil then you stop the cutting arm from falling
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 13:16
    Duane Degn wrote: »
    Are there two pins that need a PWM signal? Rate and force? Or is only one signal needed at a time?

    Both Rate and force PWM signal need to be there because if there are no signals the cutting arm fall very fast
    That is why I had to go with a [ 22uf cap and a 2.2k ohm resister which is about 5 millamps on the I/O pins shorted ] COLOR=#ff0000] in the Basic Stamp manual it call for a .1 uf cap and a 10k ohm resister [/COLOR to keep the voltage up high enough and long enough to control the arm
    While the code is doing other thing I can put a pause of about 20 to 25 with out having any problem I just have to adj the temp = value higher if the code takes longer
    I can also drive the proportioning valve amplifiers harder if I need too
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 13:46
    The reason I was thing about using an encoder disk was I know what values work


    Here is how I see this working using this 36-position Quadrature Encoder Set

    One have the cutting arm fall at let say 1/4 inch a minute
    Which be so many tick in a second
    If the rate is to slow then have the rate valve open more
    If the rate is to fast then have the rate valve close more

    Or if it still can not get this rate then open the force valve more
    Or it it still cat not get this rate then close the force valve more

    If the user had their way they would cut as fast as they can to the point where the blade is smoking

    The one valve I do not want the user to have control of is the force valve

    The user can only control the cutting rate per so many inchs a minute
  • kwinnkwinn Posts: 8,697
    edited 2013-07-04 18:52
    I know what these values are for each valve



    I have these values as well

    Here is the lowest value to the the highest and only use this range

    FOR temp = 73 TO 75 STEP 1 ' for closing the valve
    PWM Green_Led , temp, 5
    NEXT

    Other code here

    FOR temp = 75 TO 73 STEP 1 ' for opening the valve
    PWM Green_Led , temp, 5
    NEXT


    I could use this or is there a beter way of doing this

    Perhaps I am not understanding what you are trying to accomplish, or maybe the Stamp PWM is not able to provide adequate resolution to control this equipment. I really need more information to know for sure. Having only two steps between up and down is is a very narrow range of control values unless this is some kind of digital control. If that is truly all you need a rotary switch is all you need to control this device. If you want to use an encoder then select the one with the fewest steps per revolution.
  • kwinnkwinn Posts: 8,697
    edited 2013-07-04 19:07
    Duane Degn wrote: »
    I think kwinn was referring to this type of encoder. SparkFun also sells encoders; this one has a push button built in.

    Yes, the 2 bit quadrature type encoder was what I had in mind, but considering that sam_sam_sam only needs to go between 73 and 75 he could use the 2 or 3 MSbits of that encoder as the variable that is added to a constant to give a range of 4 or 8 steps.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 19:24
    kwinn wrote: »
    Having only two steps between up and down is is a very narrow range of control values unless this is some kind of digital control

    This all you need to control the proportioning valve amplifier two step of the Stamp PWM

    These values are to have the cutting stoped and not falling

    Now if you power the coil from a power supply the force coil can be power from about 300 millamps I think it was about 3 to 4 volts
    Now if you power the coil from a power supply the rate coil can be power from about 700 to 1000 millamps 14 to 16 volts

    I would like to have larger range of control for these values do you have any ideas of what I could do
    I was thinking about using a 555 timer chip and the Stamp PWM

    The problem that I have is that the 555 chip has a max voltage 18 volts and a working voltage of 15 so to use this chip on the rate coil could give a problem unless you have a work around for this problem

    kwinn wrote: »
    . If you want to use an encoder then select the one with the fewest steps per revolution.

    That was what I was thinling should work
  • kwinnkwinn Posts: 8,697
    edited 2013-07-04 19:32
    I like your idea but I have a problem the company that make this saw will only tell me so much of what each board is and what it dose this why I have make my own boards and hardware for this project

    This saw has an auto setting that messure the item to be cut and cut as many as you need but are too many thing wrong at this point to get this part to work the way it should work and right now we do not use part of the saw right now and way
    They want you send them the computer stack boards for them to be fix at his point int he game

    Replacing old obsolete/defective electronics with a propeller based system to keep older equipment working is my main use of the propeller. To do this I make use of whatever documentation is available, and a good block diagram is like manna from heaven. Schematics are also good, and having both is about as good as it gets.

    What I generally do is look for an interface point to the system that minimizes complexity, and quite often this is the point where the digital electronics interfaces with the analog/power control electronics/hardware. It sounds like you are doing the same thing with your Basic Stamp, and that you are controlling the speed of the cutting blade and the feed rate or force of the cutting blade against the material to be cut. Is this so? Is there anything else you are controlling?
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 19:37
    "Is there anything else you are controlling? " No not right now

    " and that you are controlling the speed of the cutting blade" this not being controlled by the Basic Stamp

    "It sounds like you are doing the same thing with your Basic Stamp, and that you are controlling the feed rate and force of the cutting blade against the material to be cut. Is this so? " YES

    "the analog/power control electronics" The controller on the saw even when it was working has a very narrow range of control values also this is the bigest problem with this saw
  • kwinnkwinn Posts: 8,697
    edited 2013-07-04 19:40
    @sam_sam_sam

    Looks like our posts are crossing in the ether. I will post some suggestions to your last post in a few minutes.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 19:52
    "the analog/power control electronics" has a few LM741 and few H11F1M

    The problem before I replace these chips

    In the set up mode it start 3 volts and step down 2.5 then drop to 0 volt
    In the set up mode it start 7 volts and step down 3 volts then drop to 0 volt


    I had replace chips and the control was some what better in the set up mode

    on the force valve was set up for a 3 volts ref
    on the rate valve was set up for a 7 volt ref


    In the set up mode it start 3 volts and step down in steps to 0 volt
    In the set up mode it start 7 volts and step down in steps to 0 volt


    I have not had time to trace how these chips are used
  • kwinnkwinn Posts: 8,697
    edited 2013-07-04 20:10
    *Originally Posted by*kwinn*
    Having only two steps between up and down is is a very narrow range of control values unless this is some kind of digital control
    This all you need to control the proportioning valve amplifier two step of the Stamp PWM*

    These values are to having the cutting stoped and not falling
    So this PWM signal is controlling a servo-hydraulic or pneumatic valve that controls the rate the cutting arm moves up or down at?
    Now if you power the coil from a power supply the force coil can be power from about 300 millamps I think it was about 3 to 4 volts
    Now if you power the coil from a power supply the rate coil can be power from about 700 to 1000 millamps 14 to 16 volts
    Is around 300mA moving the arm down and 700 to 1000mA moving it up? Please be specific.
    I would like to have larger range of control for these values do you have any ideas of what I could*
    I was thinking about using a 555 timer chip and the Stamp PWM*

    The problem that I have is that the 555 chip has a max voltage 18 volts and a working voltage of 15 so to use this chip on the rate coil could give a problem unless you have a work around for this problem
    As much as I like the 555 chip, there may be simpler ways to do this. We could use the Basic Stamp PWM or an 8/12 bit DAC to control a constant current source that can be adjusted from 0 to 1000mA in 256/4096 steps. An even wider current range is possible if desired. I need to look at the BS PWM function to see what is possible.
    *Originally Posted by*kwinn*
    . If you want to use an encoder then select the one with the fewest steps per revolution.
    That was what I was thinking should work

    With a narrow range you could even use a SPDT switch to increment/decrement the value up or down as long as you have a way to display the actual value.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 20:20
    "12 bit DAC to control a constant current source that can be adjusted from 0 to 1000mA in 4096 steps." this would work

    " An even wider current range is possible if desired. " up to 1.5 amp would work very well

    " I need to look at the BS PWM function to see what is possible." It only has 255 steps

    .030 to .045 volts per step
  • kwinnkwinn Posts: 8,697
    edited 2013-07-04 20:29
    OK, the LM741 is an op amp and the H11F1M is a FET OptoCoupler that can be used as an analog attenuator or digital switch so if that is all there is in the way of active components on the board it is a pretty simple interface. Now all you need to do is to figure out the minimum and maximum currents for the force and rate coils, and decide on the resolution (8 or 12 bit) you need.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 20:32
    Take a look at this would this work with a Basic stamp


    http://www.analog.com/static/imported-files/circuit_notes/CN0151.pdf
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 20:37
    kwinn wrote: »
    Now all you need to do is to figure out the minimum and maximum currents for the force and rate coils .

    This will have to wait until Monday for me to get these reading I only have the current reading that keep the cut arm from falling

    300 millamps for the force
    700 millamps for rate
  • kwinnkwinn Posts: 8,697
    edited 2013-07-04 21:02
    This will have to wait until Monday for me to get these reading I only have the current reading that keep the cut arm from falling

    300 millamps for the force
    700 millamps for rate

    The chip mentioned in post 27 would probably work but it may be overkill for this application. Figure out the minimum and maximum currents for the rate and force coils along with how many steps between the minimum and maximum for each one and I may be able to suggest the simplest way to accomplish this.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2013-07-04 21:24
    kwinn wrote: »
    Figure out the minimum and maximum currents for the rate and force coils.
    This not a problem
    kwinn wrote: »
    along with how many steps between the minimum and maximum for each one.
    The force need alot resolution in steps I can get this is one that has only 300 millamp on that coil this would 12 bit or more this valve is hard to control

    I would like to control the millamps{ 0.25 or less ] per step if this can be done ? ? ?

    [how many steps between [ 100 to 200 or more] [ from the minimum to maximum ]
    The rate dose not need as much resolution in steps 8 bit would work fine

    kwinn wrote: »
    and I may be able to suggest the simplest way to accomplish this.
  • LawsonLawson Posts: 870
    edited 2013-07-05 10:20
    For a user interface knob on a basic stamp that won't use up too much time I'd use a US Digital MA3 with one of the PWM output options. With PULSEIN you sould be able to get an updated knob positon in 2 or 5mS. (a potentiometer + ADC can do the same but it's more complex) I'd also consider replacing the saw arm position encoder with the ball-bearing version of the MA3. That way the stamp only has to read the encoder position at least 3 times a revolution but still gets the smoothness benefits of a 1024 or 4096 count per revolution encoder.

    It also sounds like the PWM outputs are significantly loaded by the external circuitry. I'd add an op-amp configured as a voltage follower to isolate the load from the PWM and filter. (the MCP6022 would be a good choice) That way you don't have to change your set-points because of your code speed. Though you will need to explicitly shut down the machine as the filters will now hold charge for minutes or hours.

    I'll also recommend making the jump to the Propeller as soon as you can. Even directly translating Pbasic to Spin and just using the BS2 library, the machine will be more responsive. (be sure to turn on block highlighting in the Spin tool) Development will be quicker too, the extra speed will postpone the need to optimize your code, while 8 hardware tasks allow you to break the problem into small easily coded/tested tasks.

    Lawson
Sign In or Register to comment.