Micro-Controller Refractometer

I am new to the programming world, but I come from the Mechanical Engineering world. With that being said, with a project I am working on, I am kind of lost on where to go and what to do. I have the concept of what needs to happen but lack about everything else.

I have been reading on a forum page LED refractometry with Arduino and I get the idea and am trying to do the same thing, but at the same time something different. I am wanting to make an inline refractometer for digital readings, that anyone can log onto the wifi and see through a page, or just an LCD screen that give me brix % of what refraction it reads. I know that I will need an LED, prism, and a CCD get up like the forum i linked. However, I have no clue where to start after I have these things.

I can figure out how to turn the LED on and set it all up mechanically, but im lost on the CCD input/output and how I make the refractometer in whole.

Can anyone help???

Your post was MOVED to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

Hey, I'm the one who started the topic in your link. Last time I had it in my hands I was designing a 3d printed support for the whole setup in a CAD tool with poor results :sweat_smile:, but then I paused it to work on my degree thesis

Based on my experience the whole project is not that hard to set up but you need a good support for the prism, the LED and the CCD, to make sure that the light beam hits the prism at a good angle and distance, and the shadow edge is projected sharply on the CCD. Another crucial point is to process the intensity/pixel signal to extract the shadow edge coordinate.

To read the CCD data, as long as you use Esben Rossel's firmware, you just need to send a packet with the configuration through the usb-serial port and read back the values. I suggest you get a F401 nucleo board and upload his firmware to spare a lot of headaches, you can find all the info here: https://tcd1304.wordpress.com/. Should you need some code I have a c++ gui tool and a few python scripts for signal processing in my github: GitHub - paolo-projects/raspi-control-panel: A control panel written in C++ with SDL designed to run on a 3.5 Raspberry Pi touchscreen


So this is the list from that page, this includes the nucleo and what he used to read the CCD. If i download that code he presented on that site and set it up the same then i should be able to read the shadow right?

Also, i was thinking a laser would be what i used to find angle of refraction and that way i can see it better and have an idea of what angle the led needs to be placed. Then i was going to create a slit for the light, rectangular, so that it only present the light to the CCD in a "runway" type ordeal. Hopefully i can use a mirror and a dark room to get all the placements correct. That shouldnt be a problem. Atleast not yet anyways lol.

But yea id like to have GUI so that i can see where the shadow stops which will give my refraction. So I will check those out and thank you for that.

Do you notice anything i am missing from my purchase list? I plan on have the LED always running for now so it doesnt need to be included into the coding, but once i make the CCD work right, id like to be able to have a push button start. Push "activate" and the led cuts on and the CCD reads refraction and after 3 or so seconds it will cut off and show results. But one task at a time

Just make sure the capacitors and resistors are the right ones and as long as you're good at soldering smd components you'll be good. Extracting the shadow edge is not so simple, you have to derive it from the intensity/pixel data. I was experimenting some stuff in the python scripts but I couldn't test it with real samples as I was still trying to print a nice support for the prism, led, ccd, but I'm bad at CAD.

And yes, you can test the setup with a laser to see if the shadow edge falls on the ccd, i.e. when the reflected point light will get brighter.

So when i upload the code from your github and run it, it should show GUI of the CCD reading the voltages across the board? Once i have it set up i can draw a rig for what leds i have and print it to test, then ill send pictures and an stl but i dont think that will be an issue.

Which Code was it exactly, not sure i am seeing the right thing.

You should at least have a basic notion on how to wire and program the nucleo board. However, it's very simple, you just need to follow the wiring scheme at Esben's website, then you plug the nucleo usb in your pc and drop the .bin firmware file into its drive

After you upload the firmware the board is ready, and I suggest you use the python script from Esben to test if the ccd is working and once you have the physical setup done, in the data-processing folder in my github, there's a script named display_datasets.py to test the signal processing (download the whole folder or it won't work).

The c++ tool in my github is more of an advanced topic, you have to compile it on a raspberry, and it's still unfinished so I wouldn't bother with it for now.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.