1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Switching Led

Discussion in 'General Electronics Chat' started by willeng, Jul 4, 2014.

  1. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Yeah, that scaled down engine is cool!
    I was so happy to read he actually machined some parts instead of CNC machining, very good!

    Cheers
     
  2. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,966
    Likes:
    1,099
    Not really sure how to answer this. Why? Well I'm not acting as a project manager, so I'm not guiding an end result. I'm more likely acting as a mentor.

    You had said earlier eons ago, that you would be after a a few setpoints (e.g. 10) rather than anything. The thumbwheel gives you the opportunity to say select 1 of 10. There's also a possibility to use multiple switches and select engineering units or even %.

    The PID controllers I used had simple thumbwheel switches that had like 1/2,1 1/8 or number for I and D. You had to order them for a particular range. Gain was set with a potentiometer.

    Later there was a controller that you could set parameters. They used a 7 segment display and made letters like a "p" and others. You could use two buttons up and down. menu and the length of the press would enter the menu or exit it.
    Lots of stuff do that. Here's an example.

    Alternatively, you can send commands via RS232 or RS485 with some controllers. On the controllers I used they had a "programming key". These just prevented operators from messing with certain parameters. So, it's just another way,
    Someone programmed ramp and soak cycles into the controller and also used the interface to log data.

    The system I designed in the 80's had keyboard commands like "set temp 800" etc. and then a display mode.
    It also did logging. There wasn't enough memory and spreadsheets were not invented, but comma separated data would have been the next step.

    Encoders are just another way of entering data. The knob can have RGB LEDS, a push and maybe about 24ish clicks per revolution.

    I'm not saying do it, but with a graphical interface is even possible with the Arduino. See: http://www.instructables.com/id/Control-your-arduino-from-your-PC-with-the-Qt-Gui/

    There's learning curves with everything you do.

    the Arduino Yun even makes a graphical Web interface possible.

    So pick!
     
  3. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Thanks Kiss,
    Ok, let me think about it & I will have a look at a few things to understand better before making a decision, it's not much good me choosing something that my two brain cells can't work out.

    To be honest after much consideration 3 set points at 10", 25" & 40" of water is all that is needed now with what I have to do with the tiny engines.
    Many more setpoints are required for what I used to do but that is not now.
    Apart from that a steady "time adjustable ramp up" from 10" to 40" of water is the only thing I require to check for choked flow conditions.
    Cheers
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,966
    Likes:
    1,099

    FYI: User interface/plotting

    It's by no means the only thing, but it may be useful, nonetheless: http://www.makerplot.com/

    It basically needs a serial port on the PC and the cost is next to nothing.
     
    • Like Like x 1
  6. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Hi Kiss,
    I will have a look at that, thanks.

    Ok, I haven't allowed for any Hysteresis as yet due to the fact that the Manometer was telling me it was turbulent flow at the Tap like I mentioned before.
    I don't know much about electronics etc but I actually do know quite a bit about dynamic airflow having worked with this since childhood.
    I could read manometers & dynamic airflow, & use Lathes & Mills etc 35 years before I learnt how to read & write.

    I know there will have to be some cancelling made as well but I wanted to fix the major cause & not remedy the problem so to speak, this is the way I tackle engineering, especially engines.
    If I had of canceled out the fluctuation in the sketch first I would have in effect cancelled out the issue of turbulent flow at the Tap.
    I have seen expensive test benches that have cancelled out all manner of things we need to read.

    I made a laminar flow element, connected it up & there is now only a minor variation hardly noticeable maybe around 2mm of water, very good.
    I have attached an Excel graph of the PID working, no particular voltages set in the sketch as yet.
    There is a time stamp on the bottom & you will see that due to the plenum the settling time is very long, but that's the plenums effect. You will notice the table top on the overshoot, this is how long the plenum takes to stabilize.
    Obviously the area under the curve needs to be a lot smaller, opposite to engines actually but the PID is working, you will see a step in the setpoint voltage but that was me with the switch on the wrong notch, not easy for me to dial things quickly now, hence the need for automation?

    I will now try with the plenum removed to get some response & then I will tackle the hysteresis if it is a problem.

    All looking ok at the moment, yes I will now put the correct values in the sketch on the graphs but I just wanted to get it working first, no good putting numbers to something that doesn't work.:)

    Cheers
     

    Attached Files:

    • PID.PNG
      PID.PNG
      File size:
      42.3 KB
      Views:
      65
  7. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Hi Kiss,
    I just did a test without the Plenum, the response is not to bad but there is still an issue, it doesn't appear to be oscillating but there is something not quite right.
    I guess it's time now to adjust some cancellation into it, just a little should do it.

    I know you said to Dampen it differently but is this ok, I liked the look of it?
    The small step in the Setpoint voltage is me again, useless?:banghead:

    It's getting there slowly.

    See Attachment!

    After just looking again it may be a small oscillation where it is worst, what do you think?

    Cheers
     

    Attached Files:

  8. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,966
    Likes:
    1,099
    Not too bad. Increasing the derivative time could help the overshoot. Is the "tabletop" due to saturation or exceeding a supply rail or number range? e.g. 255
     
  9. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Hi Kiss,

    The tabletop only happens with the plenum connected, without the plenum I can adjust the PID & have a larger overshoot amplitude & no tabletop appears.
    The reason I put it down to the conduit including the plenums response time is that the time taken from the start of the rise of the setpoint voltage to when the sensor starts reading is obviously the time taken to get the air moving in the conduit.
    The tabletop has the same time frame.

    No comment on the second test without the plenum which has not bad response & no overshoot?
    I don't think I could get the response of this test any quicker due to the volume of air in the conduit, it takes X time to get it moving. With a smaller volume conduit the response time would come down.

    Cheers
     
    Last edited: Jan 22, 2016
  10. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Hi Kiss,
    Your suggestion of clipping made me have another look.
    The reference voltage is 5V, the Arduino Board operates on 5V & is supplied externally by 12V.
    The INA126 has a dual 12V supply.
    In the test where I mentioned the tabletop, it looks like clipping & I suppose if it was saturation that it would not be so abrupt but the thing is that the amplitude where that is happening is only a fraction above 2.5V.
    I can't see how it can clip at that voltage?

    Cheers
     
  11. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,966
    Likes:
    1,099
    Last edited: Jan 22, 2016
  12. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,966
    Likes:
    1,099
    PDF page 274: http://www.atmel.com/images/atmel-2...r-atmega640-1280-1281-2560-2561_datasheet.pdf

    The reference voltage for the ADC (VREF) indicates the conversion range for the ADC. Single ended channels that exceed
    VREF will result in codes close to 0x3FF. VREF can be selected as either AVCC, internal 1.1 V reference, internal 2.56 V reference or external AREF pin

    ==

    A reminder that the first conversion should be discarded after changing the reference mode.
     
  13. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Hi Kiss,
    Yes I understand what your saying but I am using the DEFAULT reference of 5V on the Mega 2560 board.

    I found I can't make it happen even at 4V input without the Plenum today?

    I decided to make a settling chamber today & connected it up without the plenum & tested it all out again, I understood very quickly that no matter what changes you make the PID needs to be tuned to suit each & every application which is understandable. I have learned a great deal today!

    For the first time I have taken it to full power, the maximum of 4V input to the Arduino & no sign of clipping without the Plenum.
    I applied a very small amount of Hysteresis as you mentioned & found that it was very good at some settings & a bit unstable at others just like you mentioned also.

    So, being PIG headed & loving a challenge I decided to see if I could actually get it ok on all the 8 setpoint settings without to much instability, even though I only require a couple of set points.

    I was mentally challenged for hours not thinking correctly about it which is not unusual anyway, I was about to give up & thought logically for a change & realized that if all else fails in a car & you hit the brakes & can't stop you apply the Parking Brake.
    So with that philosophy in mind I applied that to the sketch & bugger me it has started to work.
    Basically for each setting the perfect scenario is an individual amount of Hysteresis that is perfect for the particular setting, so on each setting I have X amount as a starting point & the more the instability is present the more hysteresis is applied automatically cancelling the instability out.

    On each setting besides 1, once the PID has settled, there is about 1mm of water variation which is excellent & it is working.

    I have attached a quick graph of the PID stepping, it looks worse on the graph than on the manometer but I wanted to see if this is what you meant as a step test.
    I will do a better test once I know what I am doing I was moving to quickly through it in a hurry to catch you..
    Anyway what is done is done, see what you think!

    Is that the sort of test you were talking about?

    Cheers
     

    Attached Files:

  14. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,966
    Likes:
    1,099
    At 18:22 or so is what you want. PID seems to be working very well indeed. You did step the values around the values of interest which is what's necessary. You did plot what you needed to see.

    Hopefully you didn't add hysteresis, but in reality you tried to make PID act more analog like. Some options are averaging of the measured value. You could also do a running average of the measured value. Your using a successive approximation A/D and that's inherently noisy. It's by no means dual/slope. The issues you have are real word issues. Fixing them requires going to the school of "hard knocks" or whatever it is. The problems don't show up on paper.

    You want to ignore the Hysteresis. Maybe that's the same as adding it?

    A little shielding went a long way.

    Talking about vacuum cleaners, I didn't want to suggest it because of the expense, so i suggested the hair dryer. Darn, you got something almost what you will need in the end.

    Aside:
    Vacuums also bug me. The house has a bunch. The newer they are, the worse they are and it has to be a fight between the engineer and the bean counter.

    There's like 2 upright vacuums that are from the 50's at home (Kenmore and Hoover). Stupid issues like nylon holders for the roller brush. So, they break. there was a metal replacement that I managed to procure locally. The bag attachment got a little better with a fat O-ring. The zipper breaks on the bag and the universal replacement won;t zip all the way, The fix was a jewlery Lobster claw pulling down on the zipper. Now, basically the manufacturer's have discontinued the outer bags, the brush, the metal brush caps or things that should be spares. They can go for a while yet. One vacuum has the switch in the angle of the handle. A few parts makes it better than new.

    Another Hoover upright is a few years old and continues to have issues. Plastic tabs on the brush height. No lubercation. one smack and the tabs break. Wheels come in rubber or plastic, but you have to buy the plate with the plastic wheels and then change the wheels to rubber. But you have to add lubercation to the plate.

    The tools all fit with friction. Friction doesn;t last forever. So, with use the attachments and pipes fall off. The 1950's model had real catches, The 1950's model had the attachment hose that would lift the brush off the carpet, Without it you risk damage,

    The cord of the new model comes out the bottom so you trip on it. Not secured to the handle. So, you end up stepping on the cord all of the time.

    It has a place to put the tools, but the crevice tool is only half as long and there's no decent latch on the top, so as you vacuum, you risk loosing the cover and the tools from flopping.

    OK, it has a HEPA filter.

    The cover for the bag keeps falling off. A few tiny plastic ends break off when looking at them, I replaced a a couple with metal. Still have to do more. There's no latch any more. It's a rubber band now. I have another dirt devil with the same issues, but the handle broke off. It's used to clean the lint off the dryer filter - no no big deal.

    So, you vacuum with the hose and it keeps disconnecting. In 1950 they fixed that problem. Why is it still here in models produced 50 years later.

    The hose holders are broke. A solution is in the works.

    --

    The shop vac wet-vac is a tip and tell. You pull and it dumps the water on the floor. It has a right angle connector on the hose. that's OK for water, but not debris.
    Shop Vac now puts the connection on the side. (We see improvement) The center of gravity is such that it dumps. The newer shop vacs have wide legs (Improvement). The old top you still can't just replace the brushes nor is there a brush light, but YOU CAN buy the motor top w/motor for a vacuum built in the 70's.
    The hoses are nearly the same. (A good thing). No GFCI (A bad thing). So, the shop vac is 5 gallon and small which is a good thing. You can't carry it,because the latches won't hold. I upgraded the latches with standard parts,

    I don;t know what I'm trying to say. In one case you see improvement and in the other you see marketing and not engineering.

    =-

    Your doing great!
     
    Last edited: Jan 23, 2016
  15. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Hi Kiss,
    Yes, there are not only problems with vacuum cleaners these days, good old engineering seems to have been replace by the dollar.

    Obviously, I have a way to go with the fine tuning but after today I realized that I will need the finished control circuit fitted to the machine to be used to finally tune it as best I can.
    I am confident now I can tune it & get it to work in a satisfactory manner, I actually meant hysteresis cancelling in the previous post.

    I have a few more idea's on how to improve things in the sketch but I can do that over time.

    Ok what's next, what do you suggest, I can keep improving the PID sketch as I go along.

    Cheers
     
  16. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,966
    Likes:
    1,099
    Shovel snow. ;)

    Well, everything like software/computers is going subscription.

    I tend to agree.

    Are you ready to remove all of the bubble gum and paper clips that you used?

    List some unknowns.
    What's left?
    You mentioned ramping.
    is the final output going to be a graph, a number or a bunch of stuff.
    Don't hold the vacuum cleaner any longer than you have to.
    Consider the HMI (Human machine Interface) and Ergonomics or at least think about them.
    Think about the environment.

    How are you going to operate whatever it is with greasy paws or whatever.

    Where does that BCD thing come into play?

    Have you used all of the right spices? Caps sprinkled where they are supposed to be?

    Everything has gone so smooth this time around.

    Don't forget "documentation". You may have to fix it some day. :oops:
     
  17. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Hi Kiss,
    Yeah, there are some things to think about!

    First up I need to get rid of the Resistor divider setpoint voltage circuit & replace that with something that is more stable.
    I have found already that there is a drift problem with temperature change as you mentioned there would be.

    I was thinking something that has a seven segment display & easy to adjust the calibration before testing.
    Not sure what exactly, is it worth doing it with BCD switches considering the two set points required?
    Like mentioned the only setpoints I require are at 10" & 25" of water now & then the Ramp from 10" to 40" of water.

    The ramp stage;
    Do I try to add the ramp stage in the sketch & use an Interrupt to trigger it from a switch or something?

    The readings I take from the test bench are from inclined manometers, usually I just write the results down for reference.
    I have another pressure sensor that I could use to get the data but it's not much of a problem writing the results down, I usually transfer that into Excel & graph it like that.

    Once I have a good setpoint voltage circuit worked out I can start to put all the pieces together & make some proper circuit boards etc.

    I will address the Zero Cross circuit then as well, but this one seems to be working so far?

    I'll have to have a think about how to go about the setpoint voltages.

    I was thinking that maybe I could do that in the sketch as well & output a voltage back to an appropriate pin, & connect a seven segment display to verify things?
    I am just trying to avoid having to manually adjust things as it's not so easy sometimes?

    Is this worth thinking about, even with another Arduino & make that one to output the ramp signal & a good reference voltage as well as the setpoint voltages, there cheap & saves a lot of components & circuit boards?
    I could then control & adjust things with the keyboard which is easier for me?
    Basically make an adjustable voltage controller with it?

    Just a thought, what do you think?

    I'll catch up with you tomorrow, time for a shower & bed!

    Cheers
     
    Last edited: Jan 23, 2016
  18. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Hi Kiss,
    I decided to look at averaging the incoming signal like you mentioned & I worked it out in the sketch & it is better again & looking pretty good. I didn't know about that before although it should be common sense when you think about it?

    I wanted now to look at the Zero Cross section while I still have the Vacuum Cleaner hooked up to test it out.

    In the AN467 paper that I found there are several zero cross setups, I remember you said the zero cross in this paper was very good & I want to try it now & eliminate the very basic circuit I have.

    Just looking at the circuits in the pdf attached, I do have questions about them no matter which one is chosen.

    The circuit in Fig 12 is ok to use?

    Edited

    Cheers
     

    Attached Files:

    Last edited: Jan 23, 2016
  19. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Hi Kiss,
    I purchased that program you suggested & I can see that it will be of great help to me with all manner of things.
    Very good, thanks again for suggesting it, I have been playing with it & it looks good to go.

    Cheers
     
  20. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,966
    Likes:
    1,099
    Got like 12-15 inches of snow. internet is still out. I used to have a pay as you go backup internet. e.g. 1hr, 1day, 1 week, 1 month. With Widows I could also tether. Lost both methods.

    My phone is too old and some websites don't work.

    I may have router issues as well. Don't know yet.

    Everytime the Internet goes out, I need to switch to a standalone configuration to test.

    The configuration is safer than it used to be. The internet stuff is in the ceiling rafters and one time my laptop went crash. i.e. dropped

    I have a second dsl modem thats not in bridge mode, so I connect direct.

    I have a line selector that I need to modify (to use twisted pairs) before I install it that which would select bridged dsl modem, standalone modem, telco test jack and a rev telco test jack.

    The modem uses a twisted pair RJ11 that isnt reversed.

    Yesterday I did put a connnecor on a cable destined for a punch down block so I could have "broken router" internet in the place I use it most.

    Still snow to shovel.
     
  21. willeng

    willeng Member

    Joined:
    Jul 5, 2012
    Messages:
    303
    Likes:
    3
    Hi Kiss,
    I have been attempting the Ramp stage in the PID sketch & have it working beautifully now.
    Basically the ramp stage is time & amplitude adjustable which doubles as a set point feature as well, all adjustable easily with the keyboard, now I can have 255 accurate set points if needed all with a few keystrokes.
    I never realized before just how good this software thing is, it's great!

    Everything is working really nice & accurate with no problems, the new program makes things a lot easier so I can now visually see what is happening, good stuff!

    Talk to you when you thaw out:)
     

Share This Page