Fill Sensor Final Version

December 10th 2013

The hardware for the final version of the fill level sensor is running reliably and can be seen in operation in this short video clip

There have been only a few minor changes from previous circuits, mainly to remove the now redundant keypad and reposition the bluetooth unit, no major components or operation principles have been changed and a simplified operation diagram is shown below.


After some helpful comments I have removed my links on this site and created a GitHub Repository for the files here

The Files include:

  1. The Eagle schematic and PCB files which will open and can be edited with the free version of eagle 6.3 or above. To create final PCB’s load the board into eagle and use the CAM processor to create the gerber files specific for your chosen fab shop, several web sites have full instructions how to go from a design to finished PCB (hint search YouTube for eagle PCB) While the hardware could still be improved it is in a finished state with no major issues, the firmware however may still be liable to revisions and bug fixes, the current files are below, but please check back regularly or contact me if you have any issues.
  2. The MPLAB-X firmware for the version board (C Code) To compile download MPLABX and the CX32 compiler from the web site, set the project to PIC32MX120 or whatever PIC32 you are using and load in the file. There are no dependencies over and above the standard plib.h. Note to actually program the PIC32 you will need a PICKIT3 which is about $40 off Microchip or about half that for an ebay clone.
  3. The PC Control Program, which has been re-written and is now much simplified (see this additional blog posts on testing) the folder includes a zipped windows exe file and the  lazarus source files which can be re-compiled for other platforms using the appropriate IDE for your operating system, the synapse dependencies for the serial are included in the zipped file so all should just compile, I haven’t checked it on Linux or Mac but I’m sure it will be good.

Note all the above software listed is Free (or has free versions in the case of eagle) and comes in versions for Windows, Linux and Mac so it wont cost you anything to look and you may learn a bit. By careful shopping around the final bill of materials should be around $45 including a hammond case, a good supplier for the back-lights is

Connecting The Sensor

Connecting Up 1.0d

The system is wired as above (this is the diagram the electrician will need), the diagram shows the two ways that the open collector output can be wired; The count output is wired as though it is going to a PLC input, it is held high by the 10K resistor and when active it is pulled to ground so you get a standard 0-5V or 0-10V signal, the reject output is going via a small relay which would activate a mechanical device to say divert the bottle. The cable to the unit should be screened and the unit mounted so the lens can be centred on any bottle fill height required.

I have brought out the back-light and programming ports to 6 pin connectors on the prototype at the factory so I can debug in-situ, the programming port has a dummy plug in it when not being programmed or debugged but this connector can be left out of the enclosure completely if the design is stable.

As a final thought on the TSL1401, several people have now raised the fact that the DIP version of the chip is getting difficult to get. While I have 2 additional chips to support my client several other options are available. Firstly the TSL1401 comes in a SMD Version which is still manufactured and generally available (Jan 2014), mounting this SMD version on an adapter PCB with an 8 pin DIN header would work nicely. Likewise re-designing the board to put the SMD Part directly on to the PCB is another option though the lens assembly would need modifying to move the focal point back onto the board. There is an open hardware adapter PCB on Github here which could also be adapted for either of the above scenarios (at minimum you can use the eagle footprint as there is none in the library!) As of Jan 2014, a couple of ebay/alibaba listed traders and the obsolete IC stockists also seem to have stock (Rochester Electronics if you can believe the site have 40,ooo+ !!)

If your interested in the design for your factory or a similar design for a different purpose but are not confident enough to complete the project yourself please contact me.

The final part of this project (link below) covers the operations of the prototype unit for the customer.

Next >> Fill Sensor Operations