Wine Bottle fill-level sensor operations

As a final post to this project, I would like to cover the basic operation of the unit.

The final unit has been stripped of everything but a reset/calibration switch which is more operator friendly and means there is nothing internally to configure so the operator just needs to press this button to begin operation.

Pressing the Reset/calibration switch will begin the calibration procedure which should last about 30 seconds depending upon the speed of the line, the calibration procedure sets the exposure, checks it can work on a sample data set, then it will automatically switch to live run mode. During calibration the Reject output will not be operational (any externally wired LED’s from the OC Count output will not light during calibration).

Once calibrated and running the system will keep these settings until

  1. The bottling line has stopped for more than 2 hours
  2. The Reset/Calibrate switch is again pressed

As the system works using an optical sensor some procedures are necessary for correct operation:

  1. The sensor must be calibrated with the line moving so Press the button at the start of the first run when the line is moving, if the line stops for more than 30 seconds during this phase, you may need to press the button to restart the calibration. Calibration will remain in effect during the whole production run, but must be reset if  the line stops for an extended period of time or you change bottle/wine type.
  2. The sensor must be positioned with the sensor lens at the expected fill height of the liquid. The calibration procedure expects to see at least 32 bottles pass the sensor at this height in order to switch to live operation mode, should the unit be positioned incorrectly this will never happen and the system will not switch into live mode.
  3. The sensor lens and back-light surface must be clean of dirt, grease and moisture as the systems optics may interpret these as false data and thus give false readings or fail to calibrate.
  4. If the system fails to calibrate it will switch into sleep/low power mode after approximately 2 minutes and the back-light and LEDs will turn off
  5. The system will automatically switch to sleep mode an hour or two after the line stops (Sleep mode is when the back-light and LEDs are off permanently and the PIC32 has been put into sleep mode)
  6. Low fills with very frothy liquids may still pass if the top of the froth is at the correct height, future versions of the firmware may fix this.

The sensor looks for a fill level in the centre of its image sensor, to the system this will be seen as a dark band obstructing the back-light, using the standard lens the optics of the sensor can only see a range 25 cm either side of the fill-line (the centre of the lens when correctly positioned), the sensor is internally calibrated to look for this line and this is how it determines pass or fail, if it cannot see this line, it will REJECT the bottle.

High fill levels and low fill levels will both trigger the same reject.

If the standard Hammond Enclosure is used the system is not IP rated and therefore should not be exposed to water or moisture. Moisture/Fog on the lens or image sensor will stop operation. If the lens does fog or get moisture in it, note the position of the lens and unscrew it out of its mounting, wipe clean using a lint free cloth, leave to dry before screwing the lens back in to the same position it was before.

The position the lens is set to is fairly critical, while a small amount of deviation should be ok, if set incorrectly the focus will be too blurred for the program to discriminate the fill line and operation will be compromised.

Set up and calibration is done using a PC Based monitor/control program. The sensor has a bluetooth serial module built into it which can communicate to a laptop with a bluetooth connection. This program is only required during commisioning and not for normal operation. To connect to the sensor:-

  1. Install and configure the laptop bluetooth and confirm correct operation, I do not have bluetooth on my Linux Laptop but on windows 7 there will be a small bluetooth icon in the bottom right of the taskbar next to the clock, double-click on this and click on Add Device, select the device in the window and enter the pairing code (1234 is the default unless the designer has changed it)
  2. The system will come up as a serial port, make a note of the port number (eg it is COM6 on my laptop)
  3. Run the PC sensor control program (Note the windows version has been compiled to an exe but other platforms will need compiling from the lazarus source)
  4. Set the control program to the correct COM port and it should find it and display the processed sensor image (See the technical details on the system on previous posts and the C Source Firmware to understand what this means).
  5. There is an option to turn off processing and get a continuous raw image for calibration, this can be selected from the program settings tab and while screwing the lens in or out the image should sharpen, a pointy object in front of the lens at the approximate distance as the neck of the bottle such as a nail or wire should show as a thin dark band. The neck and cap settings should also be about 25% of the distance either side of the fill level, if not the default values will need to be altered, to do this consult previous posts and source code.

Note that during normal operation of the sensor there is a small polling period set aside for communicating with the Bluetooth, during critical timing loops or when the line has initially stopped the system may not respond, this is normal.

The firmware can always be improved upon, only the simplest of algorithms has been implemented and firmware may need to be altered for other level detection applications.

Problem Solving

Check for simple problems first before delving into circuit diagrams and source code.  Should problems occur with the system ask yourself if the system has previously worked on this bottle/wine type, if so it should still work and don’t go changing any of the firmware or looking for design issues.

  1. Check power is there, the system requires 24VDC at 100mA, this supply should be regulated and free from most noise.
  2. Does the backlight come on when the reset/calibrate button is pressed? if not check the system/backlight connector is in and voltage to the backlight  is ok (this will be a pulsed square wave not DC around 9-12V depending upon the backlight)
  3. Check the sensor position is set correctly at the expected level of the liquid, the lens centre Must be at that position. Note the system works on the rolling calculated average fill level so excessive level variation may cause calibration to take longer or not occur, in this case try slowing down the line temporarily so the filler works properly to get a lock then put line back to full speed once calibrated. (Note this is a partial solution as if your not getting constant fill levels you may receive excessive fails from the sensor, much better to treat the root cause of the bad fills before blaming the sensor for failing them).
  4. Check for contamination/fogging on the lens/backlight and fix as described
  5. Check for new light sources which may be interfering with or over-exposing the system (eg A torch or laser pointer hitting the bottle will throw out the exposure)

If the simple checks fail or it is a new bottle/wine type it may be the system cannot achieve calibration, set up the PC control program and look at the signal and log. Some parameters are configurable from the PC Control program without changing the firmware, check the technical documentation and make a note of the defaults before changing these as incorrect settings may stop it operating completely.

Should the REJECT or COUNT Open Collector (OC) Outputs fail then replace the MOSFET’s on the board with the same type, ditto with the backlight. The other high value components the PIC32 and the TSL1401 are also socketed and replaceable if required though these are isolated from the outside and unlikely to fail.

If you do find a bug in the firmware or schematic or produce a better design for either please contact me and I will share it here.

P001R004

For anyone confident enough to build the system themselves I have a couple of spare PCBs that can be purchased from me for $10 each plus postage (I’m going to try a web-store plug-in to wordpress but if it stuffs up then contact me directly and we will sort it out the old fashioned way)

Finally a very big thanks to Wine Bottlers Marlborough for commissioning the design and allowing it to be open sourced.

Sku
P011R004
Description
Fill Sensor PCB Revision 4
Product Options
#OptionPriceWeightStock
1Bare PCBNZ$10.000.00 gram0
Shipping

Out of Stock