ML8511 UV sensor

Can someone point me in the general direction of the difference between the 4 pin and 5 pin versions of this sensor as to what is connected where.
Thanks

Searching the Internet I get the 4 Connection "version". Link: ML8511 UV Sensor Hookup Guide - learn.sparkfun.com
Where did You find the 5 pin version?

Sorry, I should have thought to include........

GYML_8511.jpg

GYML_8511.jpg

Seems like your board has an on-board regulator. The 4 pin board must be powered with 3.3V but your board can alternatively be powered from a higher voltage, for example 5V. If you have 3.3V power available, connect that to the 3.3V pin and leave Vin unconnected. If you only have 5V, connect that to Vin and leave the 3.3 pin unconnected. Don’t connect more than 5V to the Vin pin without further research first. If may be damaged by more than 5.5V, depending on the model of regulator it contains.

Ah..ok...starting to make some sense.

This basic UV meter arrangement out there with incorrect wiring (and code) it appears.

After nearly 800 posts, you should have learned how to post links correctly!

Yes, that page is incorrect. Actually it is a mess. There are many errors.

On this page I found a schematic that shows how the 5-pin is wired internally.

It shows that the 3.3V pin is the output of the on-board regulator. On the Arduino board, the 3.3V pin is also the output pin of another 3.3V regulator. Although they are both supposed to be 3.3V, in practice, no two regulators will give the exact same voltage. One will be slightly higher than the other. If you connect them together, one could be damaged by the other. In all circuits, the general rule is never connect two outputs together. There are exceptions to that rule, of course, but this isn't one of them.

Other errors on the page from your link:

The code shows pin A1 being used, but it is not connected to anything on the diagram.

The code implies pin A0 should be connected the out OUT pin the sensor, but it is shown connected to the Vin pin.

Pin A5 on the diagram is connected to the OUT pin on the sensor. A5 is not used in the code.

The diagram on the page shows the 5 pin sensor board, but the link on the page to Amazon is to a 4 pin sensor board.

There is no pot to adjust the contrast on the LCD... The more I look, the more errors I spot, so I'm going to stop looking now.

Thanks for information.

Enclosed basis of finished item for others.
Note some details of the pot for the LCD etc. not shown for clarity as it is essentially for sensor detail.

I already had the 3v3 converter etc. in place so I went that way.

Assume from your note that it could have been equally sourced from the sensor (3v3 terminal) if 5V was fed into the Vin terminal.

Did a quick check at various voltage levels from the sensor output for varying input UV levels and they seem very close to the graph in the 8511 specs so assume all ok.

Cheers JorgoAs_Built_LCD.jpg

As_Built_LCD.jpg

You don’t say what the “3.3V convertor” is exactly, please give a link (one that can be clicked on).

To me, this all seems over complicated. When running on batteries, you need to make things as simple and efficient as possible.

I’m assuming the “3.3V converter” is a dc-dc converter. These are more efficient than regulators, except at low currents, where the overheads of their more complex internal circuits make them less efficient than regulators.

Your dc-dc converter is only powering the sensor, which will draw only a tiny current, making the converter less efficient than a 3.3V regulator. If you had a 3.3V/8MHz Pro Mini, you could have powered that also with the converter, which would have been more efficient than using that external 5V regulator. By the way, why are you using an external 5V regulator? The 5V/16MHz Pro Mini already has one on board, why not use it?

So going 3.3V for the whole circuit would be better for battery life. Problem is, the 1602 LCD won’t run on 3.3V. You could switch that for one of those OLED displays, which are very efficient, since only the pixels that are on use any power, can be read in both bright and dim conditions and don’t need a backlight.

Using your existing components, this is what I would suggest:

Can you adjust the dc-dc convertor to 5V output? If so, use that to power the Pro Mini through its 5V pin, the LCD through its 5V pin and the sensor through it’s Vin pin. If you cannot adjust the converter, remove it and connect the Pro Mini’s Vin pin to the battery. Its on-board regulator will then create 5V which can power the LCD and the sensor through it’s Vin pin.

Step down converter...had it in stock and at $1.00 why not.

https://www.ebay.com.au/itm/Mini-Step-Down-Module-DC-DC-Converter-Input-7V-28V-Output-3-3V-3A-Replace-LM2596/263005705236?hash=item3d3c5c9414:rk:24:pf:0

The rest is now working and if it doesn't suit for some reason or other, one can always change it.

My pet peeve about those step down modules (and many of the other common ones) is that they didn't put the plated through holes on a standard 0.1" grid. So you can't solder some male headers and plug the dang thing directly into a breadboard, stripboard, perfboard, protoshield, etc. You either need to mount and wire it as a separate module (and of course they don't provide any mounting holes), make a custom PCB that fits the footprint of the module, or rig the thing up some messy and inconvenient way. I don't understand why it wouldn't be obvious to the designer to put the holes on-grid.

I have some that look pretty similar to that one the OP linked to. You are right, they are not exactly on 0.1" grid, but I have found them to be near enough to work OK on breadboard and stripboard. I also have other designs that are way off 0.1" grid!

@bluejets, you have my suggestion. It would be interesting to know how much difference in current consumption between your schematic and my suggestion.

Another possible improvemernt: use an 8 MHz Pro Mini and a single (3.7V) LiPo battery. Then you don't need the 5V regulator, just use a 3.3V LDO regulator such as the MCP1700 for your UV sensor (and even that's not strictly necessary as the sensor's maximum rating is 4.6V). The Arduino will be perfectly happy at any voltage that battery produces.

You'll actually get longer battery life this way, while using half the battery capacity! That's due to the higher current used by the processor at 16 MHz vs. 8 MHz. The regulators waste almost half the available energy by themselves.