Automatic loading / unloading of a goods wagon without unnecessary empty runs and with adjustable filling control.
Automated charging station, as you can already see in the basic principle on this website, but without sticky pistons/redstone blocks and with intelligent control:
Lore only moves to the loading station when there are items in the hopper.
If you have automated farms, it can be very annoying if the lorry shuttles back and forth between the warehouse and the farm all day (even without cargo), especially if you have several farms. This can eventually affect performance, not to mention the constant noise a couple of lorries make while constantly driving around. This is implemented by two drive rails that are on the slope and are only powered when the loading hopper gives a signal. This way, the trolley only starts driving when it can pick up something at the hopper, and after unloading it automatically stops again at the (now switched off) drive rails and waits for the next delivery.
Number of items in the loading station, from which the lorry starts to move, is adjustable.
For farms that only drop items at intervals, it's nice if the lore only moves when the hopper has something to fill. However, that doesn't help if the lore then sets off for every single item, so it's still constantly going back and forth. My gold farm, for example, drops a nugget every 20 seconds or so - which means that as soon as the lore is back from its last trip (with one nugget), it's ready to go again for the next delivery (again, just one nugget). This is solved by comparing the output signal of the loading funnel with the signal of a comparison funnel. Only if the loading funnel has the same amount of items or more than the comparison funnel, the signal is passed on to the drive rails on the slope, so that the trolley only then starts to move. This value is freely adjustable via the amount of items in the comparison funnel (1 item to 5 x 64 items), i.e. if the comparison funnel contains e.g. 2 x 64 items, the loading funnel will only request the lorry when it also contains 2 x 64 items (or more).
For the comparison of the loading hopper and the comparison hopper, a memory cell is also necessary, since the signal from the loading hopper would immediately go out again as soon as the first item was in the trolley (because the loading hopper then contains fewer items than the comparison hopper and the comparator would therefore stop the signal). The sensor rail is used to reset the storage cell when the lorry is on its way to the unloading station and the signal is no longer needed.
I hope you like this solution and have fun building it!