Sciencemadness Discussion Board

Night Vision Project

VSEPR_VOID - 7-7-2019 at 10:53

Idle time is the devil's workshop so they say...

I have been looking at the prices of cheap Chinese electronics on Banggood, and being a hunter, it occurred to me that it might be cheaper to build a simple active infrared night vision sight than buy one. Even if it was not too useful, it would be a good project to learn a little bit about this subject, and advanced electronics.

The idea goes a little bit like this: There are cheap, raspberry pi compatible, no-IR filter HD cameras that only cost a few dollars. In conjunction, high power IR LEDs and a raspberry pi zero would cost a few more dollars. Thus, these components could be fitted to a hunting rifle and the HDMI video output piped into a display. I happen to have a heads-up display used for drone racing that could work.

To take this project to the next level I would want the raspberry pi, when powered on, to automatically just display the video feed from the camera, without entering a normal PC Linux start up.

In conjunction, it would be really cool to have a retical appear on the video feed, and for this reticle to be able to move up, down, left, and right by the action of several push buttons. This would allow the retical to be zeroed for the rifle after mounting.

Can anyone with experience working with micro controllers or one-board computers give me some advise on where to start? I only have worked with arduinos before, but I dont think that this will be applicable to this.

Twospoons - 7-7-2019 at 12:37

The fun part is going to be the shock loading from firing the rifle. In a past life I worked at the design end of a company making military training equipment. The laser projector we mounted on the weapons had to withstand roughly 800G shocks - for typical military automatics like the AR-16 and Steyr firing NATO 7.62. Your hunting rifle may be worse.
Just something to consider that you may not have thought of.

As far as micros are concerned, anything that can read your camera data and drive a small LCD will work. The PI is probably a good platform for this - theres an awful lot of code already out there you could leverage off. But you could probably find a suitable arduino setup too.

[Edited on 7-7-2019 by Twospoons]

VSEPR_VOID - 7-7-2019 at 13:09

Quote: Originally posted by Twospoons  
The fun part is going to be the shock loading from firing the rifle. In a past life I worked at the design end of a company making military training equipment. The laser projector we mounted on the weapons had to withstand roughly 800G shocks - for typical military automatics like the AR-16 and Steyr firing NATO 7.62. Your hunting rifle may be worse.
Just something to consider that you may not have thought of.

As far as micros are concerned, anything that can read your camera data and drive a small LCD will work. The PI is probably a good platform for this - theres an awful lot of code already out there you could leverage off. But you could probably find a suitable arduino setup too.

[Edited on 7-7-2019 by Twospoons]


Got anymore stories about designing for weapons systems?

I have seen people mount go pros, smartphones, regular cameras, and cheap chinese lasers on to there rifles. I wonder how acceleration will affect a pi.

I am leaning more and more towards arduino. I would need to write a sketch that:

1) process data from the camera and converts it to HDMI (or VGA that I can covert to HDMI)
2) Draws simple shapes on top of the video

I think that a pi might do these things better.

I also do not like the arduino approach because it is not good moving forward to other video and augmented reality projects. Sometime in the future I also want to design a HUD system.

Twospoons - 7-7-2019 at 21:09

Well, its the only place i've ever worked where I was wearing grade 5 ear protection while using a computer, and simultaneously dodging hot shell casings from the M16 my colleague was using to test microphones.
And the only place where I got to be a target (boy was that a mind fuck - standing still while someone fires an MP5 at you ..."They're only blanks! They're only blanks!")

If you look at rifle scopes you may notice some of the small cheap ones are only rated for air-rifles. There's a reason for that :)

You can use a soft mount for all the electronics, but you will need a hard mount for the camera if you want to use it as a sight. You will need to be able to lock your optics, maybe with set screws. The camera chip should survive ok. At most risk are the quartz crystals used for clocks, especially the low frequency ones (32kHz).

VSEPR_VOID - 7-7-2019 at 23:03

interesting

It ideally I would just have two accelerators on the rifle, and another two on a heads-up display. The computer would then calculate where the rifle is pointing in relation to the HUD camera's FOV, and display the retical as such. However, this programming is beyond me.

Twospoons - 8-7-2019 at 00:17

And accelerometers would be nowhere near accurate enough. Inertial systems always drift over time.

VSEPR_VOID - 8-7-2019 at 00:35

I have read that, they need to be calibrated often.

I found some similar projects that use analog NOIR cameras and displays, with no microcontroler.
https://www.thingiverse.com/thing:2121014/comments
https://www.instructables.com/id/3D-Printed-Digital-Night-Vi...

The author goes into overlaying graphics over the analog TV signal using a specific arduino shield and library. One limitation to this project was that the display resolution was very poor, making practical use limited. Ideally you want a very small, very high resolution, display. All this adds weight and cost.

It might be better to just use something like a VR headset as a display

draculic acid69 - 8-7-2019 at 03:41

Modify an old videocamera.basically a night vision scope is a handicam with more powerful LEDs or a laser attachment. if you wanted to keep it simple I'd leave the Arduino/pi out of it. I personally after experimentng situations where night vision was used,came to the conclusion that thermal imaging is where it's at in regards to detecting other living things at night. infrared has limitations in the field and now there are mobile phone attachments that give thermal imaging capabilities to the phone camera at a reasonable price.worth looking into.

[Edited on 8-7-2019 by draculic acid69]

wg48temp9 - 8-7-2019 at 05:53

i was looking for info on the cheap, raspberry pi compatible, no-IR filter HD cameras and a found a true thermal camera (not near IR I assume), MLX90640 Thermal Camera Breakout board for about £50. its only 32x24 pixels with FOV of 55deg or 110deg. Target temperature range -40 to 300C with a noise equivalent of 0.1C rms.

See https://shop.pimoroni.com/products/mlx90640-thermal-camera-b...

There are also higher resolution ones available too but I guess the price jumps to +£100

PS: 600g is not so high. Cell phones can experience over 1000g when dropped on to a hard surface. Of cause survival is very dependent on the duration of the acceleration.


VSEPR_VOID - 8-7-2019 at 06:58

I have been paying attention to thermal cameras for years now. I really like the smartphone compatible models. What sets them apart is that they integrate both regular visible light images from your smartphone, and combine them with data from the thermal camera. The result is that well the thermal camera may be low resolution, you can still see what you are looking at because the phone camera image is over layed on to it.

I dont think you will be able to see much of anything using a sub 300 dollar thermal camera sensor. The resolution and sensitivity is far too low.

Here is a really nice high end thermal scope
https://outdoorlegacygear.com/collections/thermal-rifle-scop...

https://www.youtube.com/watch?v=wgHgEHBSd1o

Here is a budget smart night vision scope
https://www.youtube.com/watch?v=wfW4ywr7M00

This one is about 500 on Amazon last I recall

draculic acid69 - 9-7-2019 at 04:41

www.lucidscience.com is a great site for this sort of stuff.

VSEPR_VOID - 9-7-2019 at 05:34

That source helped a lot in selecting a analog IR sensitive camera

It looks like super low profile cheap cameras are used in drone racing, and the PAL/NTSC analog system used for data transition has some arduino support. Here are two promising cameras

https://www.banggood.com/600TVL-2_8mm-Lens-13-Sony-Super-Had...

https://www.banggood.com/Eachine-1000TVL-13-CCD-110-Degree-2...

CuReUS - 9-7-2019 at 05:53

Quote: Originally posted by VSEPR_VOID  
I have seen people mount go pros, smartphones
Using a phone is the easiest option IMO,no need to reinvent the wheel
for the DIY'ers - https://www.wikihow.com/Make-a-Phone-Camera-Into-Night-Visio...

for those who are tech challenged -https://tectogizmo.com/4-ways-to-turn-your-cell-phone-into-a...

if you are really crazy -https://en.wikipedia.org/wiki/Zielger%C3%A4t_1229
Quote: Originally posted by Twospoons  
The fun part is going to be the shock loading from firing the rifle.
maybe the phone could be mounted on this ? -https://en.wikipedia.org/wiki/Shock_mount

[Edited on 9-7-2019 by CuReUS]

VSEPR_VOID - 9-7-2019 at 06:52

This youtuber built something similar using a Eachine 1000YVL (Link bellow)

https://www.banggood.com/Eachine-1000TVL-13-CCD-110-Degree-2...

He claims in the linked video that he IR filter is easy to remove by hand.
https://www.youtube.com/watch?v=X97iiunwmm4


This camera is only 10 grams and outputs decent quality video for the price. Well NTSC/PAL are easy to wire, I am not sure if how you would hook it up to a raspberry pi or arduino. The raspberry pi would permit more options down the road. The most limited, but easiest option, would be using a simple LCD and driver like this

https://www.ebay.com/itm/Brand-New-3-5-TFT-LCD-Multi-Role-Di...

AJKOER - 9-7-2019 at 07:23

Disclaimer, not any authority in this area.

Concept idea: Place even bulky (perhaps lower price) electronics (even a laptop), or a modified phone with sensors, in a backpack worn in the front with cutouts, or pockets, to see forward. Use a cable that can be run up your sleeve to connect output to the rifle scope, or a wireless system.

The advantage of the above is the separation from rifle firing likely spares the sensitive electronics from 800G shocks! Also, size and weight issues are not as critical.

Also, possible to have two visual displays (backpack mounted and on the rifle), where the backpack mounted provides access to a much larger screen.

And, room for a power source (batteries,...) or small solar panel.

Finally, the rifle itself, may no longer appear to be obviously modified.

[Edited on 9-7-2019 by AJKOER]

VSEPR_VOID - 9-7-2019 at 08:07

I have been reading too much sci-fy, and for a long time now I have been thinking about building a sort of integrated smart helmet system. It would monitor vitals, display important information, provide ballistic and chemical protection, and have infrared night vision and thermal cameras.

Obviously this is a very complex, expensive, and difficult thing to build. Thus why I am starting small and make a night vision sight.

Having a whole laptop in a backpack would be inelegant and impractical. It would weigh too much, be too sensitive to water, and easy to break. Just a raspberry pi or other microcontroller/one-board computer will do.

Some possibilities:

1) Having a 2" LCD display on the top of the rifle. This could be adapted from
https://www.thingiverse.com/thing:2121014
and
https://www.thingiverse.com/thing:2876738

This would also preclude anything being mounted to my face.

2) Having the display mounted in front of the dominant eye from a helmet. The camera could either be mounted on the rifle or in front of the display. The last option would be just like traditional night vision.

3) Having the display be a VR wearable display, or something functionally similar. The camera would be mounted on the front of the wearable display. This would be closer in concept to augmented reality.

Project goals:
1) permit the user to see in low light conditions
2) be low profile
3) be light weight
4) be affordable
5) augment the image with a retical, or useful information

Capture.PNG - 138kB

[Edited on 9-7-2019 by VSEPR_VOID]

Ubya - 9-7-2019 at 15:31

Quote: Originally posted by AJKOER  
Disclaimer, not any authority in this area.

Concept idea: Place even bulky (perhaps lower price) electronics (even a laptop), or a modified phone with sensors, in a backpack worn in the front with cutouts, or pockets, to see forward. Use a cable that can be run up your sleeve to connect output to the rifle scope, or a wireless system.

The advantage of the above is the separation from rifle firing likely spares the sensitive electronics from 800G shocks! Also, size and weight issues are not as critical.

Also, possible to have two visual displays (backpack mounted and on the rifle), where the backpack mounted provides access to a much larger screen.

And, room for a power source (batteries,...) or small solar panel.

Finally, the rifle itself, may no longer appear to be obviously modified.

[Edited on 9-7-2019 by AJKOER]


camera and display need to be on the rifle, so you don't gain much by putting a battery and maybe the other electronics on a backpack with cables that could tagle or rip (you would like to drop your rifle eventually)

Ubya - 9-7-2019 at 15:55

@VSEPR_VOID i have an idea. i actually modified a webcam by removing its IR filter, not hard at all, and bought on ebay an IR pass filter (https://www.ebay.com/itm/7mm-Filter-Lens-against-400-750nm-p...) to eliminate all visible light (you could use it or not, maybe not so if there was light you could see even in the visible spectrum). connecting an USB device directly to a screen is hard (at least i couldn't find an easy way) but, it is possible to connect it to a smartphone.
https://www.youtube.com/watch?v=qzlw4xsFhkI

you could mount the modified webcam on the scope, and then connect it to your phone (or a phone used just for this purpose) mounted on the rifle or on your head (at the right distance of course). in my opinion this is the most straight forward way, no raspberry or arduino, no laptop, no lcd screen, just a webcam and your phone

WIN_20190627_12_36_28_Pro.jpg - 102kB
(just some dilute copper acetate in near-IR)

draculic acid69 - 9-7-2019 at 18:04

Ubya is that a flouro light tube behind the jar in your IR picture?
Nice IR btw.

[Edited on 10-7-2019 by draculic acid69]

Sulaiman - 9-7-2019 at 19:19

Like many people, I want night vision (preferably multiple choices of wavelength ranges like 'Predator' vision.
I started with my Sony video camera that has a slide switch to remove the IR filter, and integrates over several video frames,
and I added IR leds for illumination.
Result : disappointing. Green leaves reflect IR really well masking almost all other 'targets'.

For human or animal 'targets' thermal imaging is the way to go,
but as above - it is expensive to get a high resolution thermal image.
So I too am interested in any progress made here.
The eBay HT-102 with 32x32 thermal plus 640x480 visible resolutions looks cost effective.

The g-forces on a rifle-mounted camera are probably too great for a simple mounting system,
maybe an IR targeting laser mounted on the rifle with a separate thermal imaging system off-rifle to see the target and the laser dot for aiming could be doable ?

draculic acid69 - 10-7-2019 at 02:08

Are the IR filter in videocameras the same as an external IR pass filter that you would put over the lens? My videocamera has the same switch that you flick to turn on night vision mode but I'm not sure if it just turns on the LEDs and moves the regular UV/IR filter that's used for normal viewing out of the way leaving no filter or if it puts an IR pass filter in its place.i get the feeling there's no IR pass filter inside judging by the price of them.im not sure how much difference an external pass filter would make picture quality if there isn't one inside.but as far as detecting other living things in the dark night vision can be a letdown.

Ubya - 10-7-2019 at 03:00

Quote: Originally posted by draculic acid69  
Are the IR filter in videocameras the same as an external IR pass filter that you would put over the lens? My videocamera has the same switch that you flick to turn on night vision mode but I'm not sure if it just turns on the LEDs and moves the regular UV/IR filter that's used for normal viewing out of the way leaving no filter or if it puts an IR pass filter in its place.i get the feeling there's no IR pass filter inside judging by the price of them.im not sure how much difference an external pass filter would make picture quality if there isn't one inside.but as far as detecting other living things in the dark night vision can be a letdown.


i've never seen that type of cameras where i live but to see if they use a pass filter or they just remove the ir filter is quite easy. with a pass filter you only see near ir, without any filter you see visible AND near ir, so if you point your camera to a fluorescent tube and it glows but without illuminating the rest of the room/area you have a pass filter, if the room gets brighter it just removes the ir filter.
about the quality, it is different, without a filter at all the image is reddish/pink in daylight, colors are not realistic anymore, while in the dark with only ir you see nearly black and white, or with a green tint.

about my image, the light behind the beaker is the sky/sun ;)
mh home has only fluorescent lights so at night it's compleatly dark for the camera even if the lights are all on, the sun emits tons of ir, with the pass filter i remove all visible light

AJKOER - 10-7-2019 at 04:38

Here is a related quote on some of the technical issues with sensors from another SM thread (http://www.sciencemadness.org/talk/viewthread.php?tid=148080 ):

Quote: Originally posted by wg48temp9  
Flames frequently look odd colors in pics or video due to saturation and or the spurious sensitivity of the sensor to near infrared.

In addition to the spurious sensitivity to IR the visible spectral sensitivity of the camera sensor does not accurately replicate a retina and the display primary colors have limitations too.


I also remember looking at a paper that applied the Kalman filter technique (basically, a sensor fusion and data fusion algorithm, see https://en.wikipedia.org/wiki/Kalman_filter ) to removing the 'noise' observed in making photo copies. Same concept in cleaning up noise in videos and more generally applied in 'computer vision'.

My point here, per the comments above by wg48temp9 and some of the underpinning math, that is currently integrated in various devices contemplated to be combined, is that the result of integrating various different tune devices with their inherent own algorithm based logic, is likely problematic, and one would be fortunate to arrive at any useful output.

I am assuming one would find it difficult to solve the underlying mathematics involved in such an integration and write the corresponding code to improve results.

[Edited on 10-7-2019 by AJKOER]

VSEPR_VOID - 10-7-2019 at 05:18

I wouldnt use a smart phone. This is as much a learning extercise as it is a project. Using a phone would be cheating and I want to learn more about Pis and arduinos.

I have been doing more research and this guy is mounting everything to a hunting rifle with no issue.
https://www.youtube.com/watch?v=hBtoyiAEsH4

Thermal would be amazing, but it is too expensive for me at the moment. I agree, it is better than standard IR night vision.

Ubya - 10-7-2019 at 07:10

Quote: Originally posted by VSEPR_VOID  
I wouldnt use a smart phone. This is as much a learning extercise as it is a project. Using a phone would be cheating and I want to learn more about Pis and arduinos.

I have been doing more research and this guy is mounting everything to a hunting rifle with no issue.
https://www.youtube.com/watch?v=hBtoyiAEsH4

Thermal would be amazing, but it is too expensive for me at the moment. I agree, it is better than standard IR night vision.


a phone would be the cheapest option but i get it, you want to gain experience with with the arduino and pi worlds, if this is the case i don't recommend PI, not because it can't do the job but because it would be overkill, you just need to connect a camera to a screen, using a pc (raspberry pi is literally a single board computer) seems wasteful.
i regularly use arduino for my projects (even thought i can't program yet, i just copy and modify codes i find on the web) and it does its job most of the time.

https://www.youtube.com/watch?v=Dp3RMb0e1eA
this would me my way to go to your project. removing the ir filter is as easy as unscrewing the lens and chipping the filter away (most of the time they are glued, breaking them is the only way). please use an arduino nano or micro, not an uno, UNOs are mostly for prototyping (sorry i get triggered by people that use unos for projects where a nano is the way to go). this seems the most compact way to go, and uses arduino as you wished

Twospoons - 10-7-2019 at 15:47

Quote: Originally posted by VSEPR_VOID  
This is as much a learning extercise as it is a project.


Yep, sometimes the journey is more important than the destination.
I regularly build things I could have more simply bought, for this very reason. At the end I have the thing I wanted plus a lot more knowledge.

draculic acid69 - 10-7-2019 at 18:46

I still think the Arduino is pointless to use for a night vision device.a camera connected to a screen is all it takes.the Arduino would just be an unnecessary piece that doesn't contribute anything other than complicating things.to modify a video camera with a laser attachment is the simplest route.

andy1988 - 10-7-2019 at 19:06

If it's mobile on a gun handling video... I'd suggest an FPGA over an ardunio or pi as I'd expect the FPGA to last a lot longer on battery and it would be lower latency (not sluggish/delayed frames). An ardunio or pi may last a long time under other use cases, like sampling at 1Hz then using power saving "sleep" modes the rest of the time.

Personally I wouldn't do 25fps or whatever the sensor can handle but do 4fps or something to conserve battery. And read up on the power saving features the hardware has and use them.

I guess it could do some processing to autofocus on warmer areas, depending on whatever focusing system the camera has.

At a glance these are the tools I'd look into, Icestudio would be my preferred environment:
https://www.youtube.com/watch?v=aRAyVoljc_w
https://jderobot.org/Jordonezcerezo-tfg

But I'm sure you could find many 'FPGA computer vision' project starting points:
https://hackaday.io/project/10178-fpga-based-camera-vision-f...

VSEPR_VOID - 14-7-2019 at 12:37

The Jetson Nano looks like an interesting platform. To go with it, Unity and OpenCV look like cool augmented reality programs to play with

VSEPR_VOID - 5-8-2019 at 03:40

I just wanted to post this:

This is a data sheet for a M01_4K_V3.0 HDMI to MIPI driver board. I am using this for my project. It connects a regular HDMI cable to a phone screen, such as:

https://www.ebay.com/itm/5-5-inch-1920-1080-LCD-Display-3D-P...

I had to get this data sheet from a Chinese supplier, so I am posting it for the public.




Attachment: M01_4K_V3.0 HDMI TO MIPI Specification sheet.pdf (1.1MB)
This file has been downloaded 625 times


VSEPR_VOID - 13-8-2019 at 19:48

Update

I am working on the new display and driver housings.

Here is an interesting IR camera project using a raspberry pi zero and NOIR camera

https://robotstyles.blogspot.com/2018/04/gavino-unas-gafas-d...

The range is short and it uses wifi to transmit the video.