Construction of the filling system. NEED HELP

First of all, I apologize for my English, but I hope everything is understandable

Below, I will describe my project, which I would like to address. So, I would like to help both programming with Arduino and more. I hope that I put my post in the right place and, of course, I hope that I will find a lot of help in this project. I hope that this will be useful and helpful for many others.

1st process

The impeller (hereinafter the vacuum relay) switches on and fills the main hopper. The switch-off time for the immersion relay should be changed. Small value 20sec.
Immersion relay (Analog output pin1) on and off is controlled by a volume sensor connected to Arduino. (Analog input pin1)

Actions

  • Immersion (switching on sensor sensor 1 = 1 vacuum relay analog pin 1)
  • Brush off (turning off according to timed order)
  • 20 sec non-performance alarm (analog output pin2) and shutdown of the vacuum relay (Failure is detected by the volume sensor if it is active after the 20 seconds of the suction cycle) (NB: THE TIME SHOULD BE REMAINED)
  • Wait for 10 sec and re-enable the vacuum relay (NB: TIME MAKES TO CHANGE)
  • In the event of 20 seconds, the alarm turns off and everything goes on normally. (NB: THE TIME SHOULD BE TAKEN TO CHANGE)

2nd process

The valve between the sucker pouch and the weighing bottle (bag filling machine)

Actions

  • Weighing switch (analog output pin3) opens as a weight pouch
    weight is min 1kg (NB: WEIGHT SHOULD CHANGE)
  • The camshaft closes (analog output pin4) if the weighing hopper weight is max. 10 kg (NB: WEIGHT SHOULD CHANGE)
  • The camshaft must be in the closed position when the suction is ON !!!!!!!!!!
    (ie the valve seat can only be opened when the stomp is stopped. After the stomp had stopped, there should be a delay of 2-3 sec, and only then open the valve)

3rd process

The weight registers the weight difference. If the weighing cub is min 1kg and added to the load until the weight reaches max 10kg, then the difference is + -9kg.
Weighing cycles are performed with the weight pouch valve. Measure before opening the valve and measuring the weight difference between the weights obtained from the closure of the valve = weight
It is necessary to save the weight on the SD card (when the card is filled up, it will overwrite the most distant data) and send it in numerical form with the weight of the recorded time to the LAN network server.
The weight bin also has a volume sensor that detects when the amount of material falls below 1kg (sensor input analog 2) and (alarm output analog pin 4)

Process 4
The display should reflect the instantaneous weight (total weight of the total) and the entire work of the prostacyus and the current operation. The date and time should also appear on the screen. You should also be able to connect to the server.
The total weighed amount should be timed, for example, the amount of weighing 8 hours is 800kg, or the weighted amount of 12 hours is 1000kg. Scheduling can take place automatically and should be changed. For example, from 8:00 to 20:00. You would need to save this amount separately on an SD card and send it to the server. (NB: the record must be able to be changed)

In-use hardware

  • Arduino R3 Mega2560 REV3
  • Ethernet Board W5100
  • Miroad 20x4 LCD display Module LK51
  • Aluminum Ally 50kg Load cell sensor
  • Weighing sensor AD modul 24bit A / D HX711
  • LJC18A3-H-Z / BX Approach Sensor Switch 6-36V
  • Relays

You have described a complex process that should certainly be achievable with a Mega.

If you are a beginner you should break your learning down into lots of small pieces. For example write a short program to detect one of your sensors and display the output on the Serial Monitor. Write another short program to control a relay. And do the same for every part of your project, one at a time. Only when you know how to do all the parts separately should you start the process of building an integrated project.

Have a look at Planning and Implementing a Program. See how it is a collection of small parts.

If you want help with interfacing your Arduino to any specific piece of equipment please post a link to the datasheet for the item.

...R

Hi,
Let me congratulate you for describing your project so detailed: it wins by far 95% of similar situations.
Your english, I am afraid, is a bit insufficient (I am not native english; maybe a native one can overlap some mistakes) but this is not a major problem: if something is not completely clear we will ask once and again till it is understandable.
Your project is not simple (not too complicated, neither). In my opinion, a process sketch would help clarifying things. Do not hesitate doing it by hand. Mark on it the elements you describe (hopper, filler, ...).
For the moment, I think, you should not enter in details as "analog output 1" (by the way, the MEGA has not "analog" -has PWM- outputs). This corresponds to a second (or later?) stage.
Regards.

I haven't read it in detail, but I did see lots of different parts here.

Start by getting every single sensor, then every single step of the process to work. On such step could be the weighing:

  1. get the hopper to open and close on command.
  2. get to read the weight sensor.
  3. integrate the two: open the hopper, read the weigh sensor until the desired weight is reached, close the hopper.
    Now you have one complete function done, move on to the next step.
    So you do it for all steps. Place it in separate functions, and when all steps work you can quite easily link them together by calling the functions in order. In the above example you could write the function so it takes the desired weight as parameter, if you want to be able to change this for every recipe.

The most important here is to break down your project in as small as possible steps, and use that as building blocks. Good luck! And if you have a problem with any specific building block, or how to link them together, feel free to ask questions. The more specific the question the more specific the answer you'll get.

Did your professor give you any other requirements for the project?
When is the project due?
We typically advise that you break it into steps .
Make each step work and then add the next step to it

Now it's time to start the project. Meanwhile, I have gathered ideas and ideas for doing it.
As of now, I've got to work on weight and an easier way to relay the switch. However, as of now, I've already tucked it over how to set the weight to switch the switch so that when the weight is about 6 kg and switch off when the weight is 15kg. It worked with the delay. But that's not what I'm looking for. It would be necessary for the weight to work continuously and could be seen on the LCD display, but it would also be necessary to have the weight on the SD card and the network written in time (DS3231 was also purchased). It would then be necessary to know how much weight the weight of this cycle was due to.
It should also be possible to change the value of the tare and it is also necessary that the value of the tare can be entered by itself and saved.

Sounds like you have your work cut out for you. Good luck.

For the time part: as you're connected to Internet you don't need an RTC. Just get the time through NTP. More accurate even.

I need RTC so that if something happens to the network then the SD card will still remain on the time scale

The Arduino can keep track of time quite well - not as accurate as an RTC of course. Anyway, up to you. Adding an RTC doesn't cost much anyway.

Umz:
It would be necessary for the weight to work continuously and could be seen on the LCD display, but it would also be necessary to have the weight on the SD card and the network written in time (DS3231 was also purchased). It would then be necessary to know how much weight the weight of this cycle was due to.

This reads like a discussion with yourself (I do that, but I don't publish it :slight_smile: ) as I don't see any specific question that we can help with.

If you have a program that is not doing what you want then you need to post the program and tell us in as much detail as possible what it actually does and what you want it to do that is different.

...R

The first piece of equipment you mention is a "vacuum relay". Why? Vacuum relays are used in very high voltage situations and new, are very expensive. Is there some other name you can find for what you are planning to use?

Paul

the vacuum relay is not so accurate there. I mean the ordinary relays that turn on the pneumatic valve

Umz:
the vacuum relay is not so accurate there. I mean the ordinary relays that turn on the pneumatic valve

Ok, thank you. Makes sense, now.

From the voice of experience, may I suggest the very first step in your project should be to get the LCD display working. Then, as you debug your program, you can display variable values there, rather than the Serial.print() to the PC. The PC is fine, except when a variable is displayed many hundred of times, it is hard to see when it changes.

Paul

Paul_KD7HB:
From the voice of experience, may I suggest the very first step in your project should be to get the LCD display working.

I understand why you say that but my advice would be the exact opposite - leave the LCD stuff to last because in many Threads I have seen the important parts of the program are completely lost in a spaghetti of poorly organized LCD code.

Now the OP has a choice to make :slight_smile:

...R

Overwriting the data on a 1602 LCD very frequently is not good for readability of the display either.

As of today, I have to admit that I can not do anything. Ok I get the weight on the LCD. I can also turn it off and on relay if the weight drops to 5KG and so on. But that’s all … using if and else. I do not know if this code even hangs up here because it’s still not what I would like to get. As a beginner, I can not really understand how to do something. Thinking as it is, but I can not put it in the code. Of course, I have not given up yet, but it seems that I will go for years: P: P

First, I do not understand how I can do so if scale.get_unit <5 is then turned on at the time specified by relay nr1. If, however, the weight does not rise within a specified time, then the relay nr 2 is switched on once the scale.get_unit is greater than 5.
At the same time, relay No 3 is switched on as sensor 1 is high for a specified time.
while the times for relay 1 and relay 3 are different

Post the code that you have so far. Also, can you elaborate on the piece you don't understand - I'm not clear what the requirement is.

It often helps to write down your requirements in detail, in normal language, in separate points.

What does relay 1 have to do? Same for relay 2? What other requirements?

As it seems there are different parameters in play you may need to implement a finite state machine. Lots of tutorials - do a Google search on the term - good chance also in your native language.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <HX711.h>
//#include <Ethernet.h>
//#include <DS3231.h>


//DS3231  rtc(SDA, SCL);
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
#define DOUT  3
#define CLK  2
HX711 scale(DOUT, CLK);
float calibration_factor = -4050.0;

#define PIN_VALVE 8
#define VALVE_ON LOW
#define VALVE_OFF HIGH




void setup() {
  pinMode(PIN_VALVE, OUTPUT);
  Serial.begin(9600);
  lcd.begin (20, 4);
}
void loop() {
  scale.set_scale(calibration_factor);
  if (scale.get_units() < 5) {
    lcd.setCursor(0, 0);
    lcd.print("empty");
    digitalWrite(PIN_VALVE, VALVE_ON);
    delay(100);
    lcd.clear();
  }
  else {

  }
  if (scale.get_units() > 5) {
    lcd.setCursor(0, 0);
    lcd.print ("full");
    digitalWrite(PIN_VALVE, VALVE_OFF);
    delay(100);
    lcd.clear();
  }
  else {
  }
  lcd.setCursor(10, 0);
  lcd.print(scale.get_units(50), 1);
  delay(5);
}

Disadvantages of the code that I can not fix. flashing LCD text, can not timeline relays etc.