Project showing occasional eratic behaviour??

Hi guys!
I have built a shed lift/elevator used by myself only.... via a hydraulic ram and single phase power pack.
It is only used for 1 floor travel only and has built in safety features ie. door sensors (magnetic reed switches) and electric door latches (for sliding doors) that have timing features. It uses a top and bottom limit switch to recognise where the lift is in order for the programme to know what to do next.
I am using ARDUINO UNO with a 12v transformer for the board power and output voltage for the 8 channel relay board to power the door latches, internal LED light and 12volt relays to the hydraulic power pack.
The relay board is powered by another external 5v transformer for the inputs.
3 pushbutton switches which are all N/O until pressed( ground floor call button, top floor call button and an internal button as a safety feature used in case someone can't open the doors in time after timer reactivates door locks) are programmed using internal pull ups.
I have used the ARDUINO analogue pins for the inputs and digital pins for the outputs and have not earthed the board via the earth pins to anything in case of interference.
My problem is that the programme runs great and everything is doing what it is supposed to but occasionally has hickups and does random things in no particular sequence. Sometimes when the lift is called from the ground floor, the doors unlock(which is normal) you get in and close the doors, the timer activates(normal) then instead of the lift motor kicking in, the top floor, bottom floor and internal doors unlock all together for the timed period then relock then do it all over again for the second time then it appears the loop cycle finishes then the light goes out. The internal button is then pressed to unlock the doors so I can get out!
Sometimes when I enter the lift from the first floor I close the outside door then the lift goes down with me still holding the internal door open.....which is a big NO NO!!
I have tested and re-tested all the sensors and all appears to be normal......so unwillingly I am asking someone with FRESH EYES for some guidance as frustration is getting the better of me.
Solving this one on my own would have been a great learning curve!!

home_elevator_new_int_pullup.ino (8.26 KB)

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Also the spec of your power supplies, please.

The fact that you have the pull-ups on, means that you have no digital inputs open to cause intermittent operation.

Tom...... :slight_smile:

Hi,

Just an advice: you are compromising your personal health (and perhaps other's). For those mechanisms you have to have some security circuits that ARE NOT be operated by arduino (even by a PLC or similar), specially manoeuvers connected to emergency siwitches ond so on (they have to be cabled "old way"; you have to use special components -security certified; double circuit, etcetera- too, but, at least, use a phisic circuit).

Then, I would identify what other manoeuvers are security concerned (i.e.: lift moving with open doors), and make absolutely sure that they cannot happen (i.e.: by doubling them, again using a "phisic" cabling: another limit switch(es) locking the moving element order (motor/pump; or whatever you use).

Don't worry: arduino has a lot of things to do in your lift automation apart from those ones.

Best regards.

I agree with everything @vffgaston has said.

I have not studied your program carefully but my immediate impression is that it should be organized differently.

  • You should read all the switches/sensors at the same time.
  • You should NEVER use the delay() function because it prevents other actions being detected.
  • Your code should be designed so that loop() repeats hundreds or thousands of times per second. That way it can quickly detect changed sensor states.
  • Write your code as a series of short functions each with only about 10 lines of code.

Have a look at Planning and Implementing a Program

...R

Thanks Guys for your concern as safety has been thought of in advance!
This is only the first step of many of implementing external features for safety sake.
I am just trying in stages for system errors before I proceed to the next, as I find the diagnostics a little easier to target when faults appear.

AZZAMAX, I think Tom was referring to a schematic diagram rather than a photo of the wiring.

AZZAMAX:
Thanks Guys for your concern as safety has been thought of in advance!

For the avoidance of doubt, the comments about programming that I made in Reply #3 were not related to safety concerns - just to the functionality of the system.

...R

The 1st thing I'd do is add print statements and use the serial monitor so you can "see" what's going on. You can send-out variable values & sensor states as well as messages about what the program is doing. i.e. Initializing, Up-button pressed, Going-up, Opening door, At lower limit, etc.

I am using ARDUINO UNO with a 12v transformer for the board power and output voltage for the 8 channel relay board to power the door latches, internal LED light and 12volt relays to the hydraulic power pack.

I also try running the Arduino on a power supply separate from any relays, motors, and solenoids. Maybe temporarily run it from batteries to make sure no noise or glitches from the power supplies or AC power line can get into the "brain".

I suspect it's a hardware glitch on the power supply or an I/O line, but tracking it down will be easier with some help from software messages.

BTW - You're really not using a "transformer", because a transformer is AC-in and AC-out. You are using a power supply (AC-in, DC-out) which contains a step-down transformer.

via a hydraulic ram

If the main lift is a hydraulic ram like they use to lift cars in auto-repair shops that should be very safe because it's can't drop quickly.

The first thing I would do is to use external pull up resistors of about 1K. The internal ones are very weak and are not strong enough for a noisy environment like you have.

Hi,

I'd like to make a comment on a software approach to this case:

This is an -apparently- simple project (from the side of software, I mean). But there are not simple projects involving software, as everybody knows.

This statement is particularly true if one has to deal with "real time" and "outside world"; you would say that almost every arduino project is "real time". Perhaps I'm thinking on these projects that are "aware" of what happens in the outside and change their responses heavily depending on the "status" of the system.

Let's analyse this case: What the system has to do when the person inside the cabin presses the 1st floor button varies depending on what the system is doing: if the lift is stopped the next action to take is closing the doors; from this very moment up to the one that the lift reaches the first floor and opens the doors the 1st floor button is "inactive" (of course I'm simplifying things: there are other things to take into account: overweight sensor, optical detector of people accross the doors, and so on). It happens the same with all the other buttons. The response of the system to a person crossing the doors is different too depending on what the lift is doing and so happens with almost all the inputs to the system.

To program such a logic is solved reasonably well by the "ladders logic" of PLC's; although it was not created specifically for this purpose (solving such problems), it gives the programer another view on the solution that is more "readable" than "plain code". On the other hand, "advanced" programming techniques like dividing the problem into functions (or subs) that help to approach and maintain other software projects do not help to program the intrinsic complexity of this programs: one starts coding using "if" statements and finally finds that have nested a completely unnaceptable number of conditions.

Personally, the only solution that I have found useful to approach these projects is the use of an "state automaton" ("automata"): the analisys is much simpler and, although you have to make an initial effort (and, previously studying the technique, should you don't know it) to define the neccesary variables (status, nextstatus, event, transition) and the array containing the "status-events-transitions" table, the subsequent programming work (and the maintenance of the software) is much simpler.

Regards and good night (to europeans -the good night, I mean; regards for everybody).

Sorry, it's me again: a question for the more trained forers:

How do I do to find this thread tomorrow? (I mean, in case there are not new posts on it).

(Ok, ok, I'll keep the text inside the box at the top. The question would be: How can I find a thread i've written on?) :confused:

Regards

vffgaston:
Sorry, it's me again: a question for the more trained forers:

How do I do to find this thread tomorrow? (I mean, in case there are not new posts on it).

(Ok, ok, I'll keep the text inside the box at the top. The question would be: How can I find a thread i've written on?) :confused:

Regards

You could simply bookmark it in your browser. Alternatively, click on 'Receive Emails and Alerts' at the bottom and you'll receive an email when someone replies, with a link back to the thread. There are bound to be more replies to this thread.

How can I find a thread i've written on

Click on you name on any thread and go to your profile. Then click show posts.

vffgaston:
How do I do to find this thread tomorrow? (I mean, in case there are not new posts on it).

I have a few sections in my Firefox bookmarks. One of them is Arduino Follow Up and I save bookmarks there for things I want to remember to look at again tomorrow. I never have more than a few items in that list.

...R

Robin2:
I have a few sections in my Firefox bookmarks. One of them is Arduino Follow Up and I save bookmarks there for things I want to remember to look at again tomorrow. I never have more than a few items in that list.

...R

I do exactly the same.

Wow guys, a lot to take in......so many variables and options!
I am working on a schematic of the wiring and hopefully should have it done very soon.
I thank you all for your time and input to my woes!
DVDdoug: It is in fact a forklift ram I am using and not a cable line setup.....for that particular reason if the unit fails it would be a slower decent, then again the actual distance between floors is only 2.4mtrs.
Grumpy_mike: I used internal pull ups only because every body says to when reading forums on this topic.
I will however try external pull ups along with DVDdoug's suggestion on powering the arduino separately.

I just am confused as to why the programme runs great 4-5 times then has these occasional HISSY FITS.

Thanks Robin2 for your suggestions, I understand the delays would blind things a little and yes I will have to work on another approach on setting the programme up better.....cheers :slight_smile:
I will post my outcome on some simple alternatives recommended, before diving in and changing everything.

m confused as to why the programme runs great 4-5 times then has these occasional HISSY FITS.

That is always caused by interference / lack of decoupling capacitors.

Managed to draw up a wiring circuit today but had little time to spend on it.
Not as good as CAD.....but a bit better than a hand drawn version. Not my forte!!
BBBEEE KIND!! :slight_smile:

Doc4.docx.pdf (278 KB)

Hi,
Pity its a trial copy, but we can see the basics and its clear to see your wiring, good try.

Can you locate the 5V regulator on the arduino board.

See if it feels hot, the fact that you have 12V going in and the regulator drops it to 5V, the volt drop and current may be causing thermal shutdown of the regulator.

A ventilation fan on the board will tell if that is the case.
You may have to provide the arduino with its own supply, possibly a 5V "wallwart", or pre-regulate the 12v down to 9V before its fed to the arduino.

Tom..... :slight_smile:

Thanks TomGeorge, will try separate and lowered power supply along with suggested external pull up resistors and see if that helps with the possible interference.
Much appreciated!
Cheers, Aaron.