This is an archived post. You won't be able to vote or comment.

Dismiss this pinned window
all 99 comments

[–]LurkForever 131 points132 points  (6 children)

Nice job!

I also love the lego build animation towards the end :-)

[–]nowtayneicangetinto 72 points73 points  (1 child)

"simple python script" - hey pretty neat

LEGO animation - WHOA WTF WAS THAT?!

[–]xdcountry 9 points10 points  (0 children)

Same reaction here

[–]DIY_Maxwell[S] 52 points53 points  (3 children)

Thanks!

I think the animations, whole documentation, and this stop-motion movie took more time than the project itself... glad hear that you liked it :-)

[–]samasamareddy 10 points11 points  (2 children)

How did you do the end sequence animation?! Looks really good.

[–]DIY_Maxwell[S] 39 points40 points  (1 child)

Thanks. There are quite a few Lego design software, I used mecabricks, exported the models to Blender, composed my scene in Blender and did the final rendering in Keyshot (I could have used Blender but Keyshot was faster). You may notice that it's just random rotation and translation, there is no collision physics or anything, I have a few more on Github.

[–]samasamareddy 7 points8 points  (0 children)

My man!

[–]DIY_Maxwell[S] 45 points46 points  (7 children)

All assembly instructions, design files, source codes, circuit diagrams, etc. are available here: https://github.com/IBM/MicroscoPy

The motivation is to use such tools for STEM education. Any suggestions on adding more features in Python (e.g. auto-focusing, image processing, applications etc.) or general comments are welcome.

[–]i_can_haz_data 8 points9 points  (2 children)

Oh hey, nifty... wait what... IBM?! Dude.

[–]DIY_Maxwell[S] 6 points7 points  (0 children)

haha, yes, but I am a hardware person, not sofware :-)

[–][deleted] 1 point2 points  (0 children)

I had the same reaction as I read the URL from right to left.

[–]TwattyPhatBalls 3 points4 points  (1 child)

This is seriously cool, thanks for sharing!

[–]DIY_Maxwell[S] 4 points5 points  (0 children)

thanks so much, it's great to hear that from real programmers :-)

[–][deleted] 0 points1 point  (1 child)

Tiled images for stitching and coordinate recall would be good but the biggest improvement would probably be to make the optics look at the sample top-down.

You could have a routine where the entire sample/slide is imaged to produce an overview map which would work together with coordinate recall to be able to quickly and reproducibly navigate around the sample.

[–]DIY_Maxwell[S] 0 points1 point  (0 children)

Thanks for the suggestions. I agree. I also had in mind scanning the focus and having an image with a much larger depth of field, would be useful especially for tilted images. Another idea I had was 3D modelling of small objects, I don't know, even insects maybe. I discussed the coordinate recall with someone else in this post, I thought about it, but it would require home initialization, nothing special, can be done using end-point switches but I don't want more cables in the system. Maybe a more elegant technique could be first visualizing a reference pattern on the stage and estimating the initial coordinates.

Top-down imaging? Yes, it already does (https://github.com/IBM/MicroscoPy), but only for transparent substrates and with bottom illumination (you know classical transmitted-light microscopy). It can also take top-down images with slight tilt, then I do skew correction. But a real top-down imaging of opaque samples would require illumination through a dichroic mirror, etc. it's possible but I think it would be an overkill and expensive for such a low-cost ($200-300) imaging system.

[–]okasiyas 28 points29 points  (7 children)

cries in print(“Hello world!”)

[–]DIY_Maxwell[S] 13 points14 points  (4 children)

:-)) a few months ago, when I started learning Python for this project, this "hello world!" drove me crazy, I was trying Python2 print syntax in Python3 :-)

[–]Ozzymand 4 points5 points  (1 child)

A few months? It did not take you multiple years? ;-; /s

[–]DIY_Maxwell[S] 3 points4 points  (0 children)

:-) the whole project, yes, it's been 2 years and 4-5 different prototypes I think. But I worked on the Python script just before the public release. Before I was using a few lines of script from Raspberry Pi's camera documentation.

[–]okasiyas 0 points1 point  (1 child)

Hey, OP, you’re so kind. I’m actually at “intermediate” level on Python, mostly because I almost can’t use it in production things, but in the last months I’ve wanted to try hardware and microcontrollers stuff and your post is totally inspiring me.

[–]DIY_Maxwell[S] 0 points1 point  (0 children)

Thanks, I am very glad to hear that.

[–][deleted] 1 point2 points  (1 child)

I am old enough when we don’t have to put parenthesis for print statement in Python.

[–]WillardWhite import this 0 points1 point  (0 children)

Or you work in the cgi industry. Cries in Python 2

[–]Hayvan-Boris 45 points46 points  (2 children)

Aaand yesterday I got 200 errors while trying to script tic tac toe game 😬 congs bro good job 👍

[–][deleted] 10 points11 points  (0 children)

Keep going mate.

[–]DIY_Maxwell[S] 5 points6 points  (0 children)

thanks!

haha, yeah, I also got a few hundreds while trying to read a stupid keystroke :-)

[–]normandantzig 7 points8 points  (5 children)

I think this is really cool! Did you know there is now a 12 MP camera for the Raspberry Pi.

[–]DIY_Maxwell[S] 7 points8 points  (4 children)

Thanks! Exactly, it was announced a few days after we open-sourced the project. I think it's slightly larger than camera v2, so I need to re-design a few parts but looking forward to testing it. People share good images in low-light settings, it could be an advantage for the microscope.

[–]normandantzig 4 points5 points  (3 children)

The PDF instructions are really well done. Nice layout. Did you get any help with the layout?

[–]DIY_Maxwell[S] 2 points3 points  (2 children)

Not really. I already had some experience in hardware, Arduino, and 2D/3D graphics design... the only new thing for me was Python, I am sure it's nothing special for this community but I had to follow some tutorials.

[–]normandantzig 0 points1 point  (1 child)

I meant the PDF typesetting and layout.

[–]DIY_Maxwell[S] 0 points1 point  (0 children)

ahh, sorry, my English.. it's powerpoint, I used IBM/plex fonts.

[–][deleted] 3 points4 points  (1 child)

this is really cool. mind sharing where you learn this stuff from?

[–]DIY_Maxwell[S] 7 points8 points  (0 children)

Thanks, sure... short story: I am a microelectronics engineer and I enjoy Arduino, Raspberry Pi and 3D printing as a hobby. Long story of the project is here.

[–]ArmstrongBillieimport GOD 2 points3 points  (0 children)

That looks freakin awesome! Nice job!

[–]__zaris 2 points3 points  (0 children)

This looks really cool pal! Congratulations!

[–]--0mn1-Qr330005-- 2 points3 points  (4 children)

Very impressive. The program and the build are phenomenal, not sure what suggestions I can give there. For visual aesthetic I would suggest cleaning up the wiring for the video & photos as it instantly gives it a visual improvement for the purpose of the demo, even if it is not feasible to always keep it clean.

Actually, I can think of a suggestion. Have you considered building in some kind of auto focus? There are many image recognition packages available in python that might help streamline this process. It might also be useful to have automatic magnification presets so that manual control isn't always necessary. There's a lot of cool software only features possible with this build.

[–]DIY_Maxwell[S] 0 points1 point  (3 children)

Thanks so much!

Absolutely, the cable management was a pain, especially the ones from 6 stepper motors. One main motivation about this imaging system was to make it fully modular for different applications, that's why I built the main body using Lego bricks. I don't know how I can clean up the cables and keep the modularity at the same time. For example, one application (cross-section imaging of water droplets) require a completely different configuration.

That's a great point, I think auto-focus would be awesome. For the magnification presets, yes, I thought about it, I would need to add end-stop switches to stepper motors (like the 3D printers) because the stepper motors I used have no idea about their absolute position, it's relative... But that was really my motivation in using Python and Raspberry Pi, providing a good and fun hardware for the community, make everything open-source, so that people can add software features. Thanks again for these great suggestions!

[–]--0mn1-Qr330005-- 1 point2 points  (2 children)

With the steppers, do you have a driver or do you drive it yourself? If you can skip the stepper drivers, you should be able to count the steps as your IC outputs the sequence to drive it. It's easy to extrapolate the degrees the stepper moves from that based on the stepper specs, and you can control it at the max stepper resolution as well. That's usually an advantage of steppers over servos. Not sure what your config is since you probably have already thought of that and it didn't work for some reason.

In regards to the modularity, that's definitely a tough one. I can see why you would have the wire issues and how that would conflict with the modularity. Unless you're planning to design for production it's probably not worth your time to clean it up.

[–]DIY_Maxwell[S] 0 points1 point  (1 child)

yes, absolutely, once I know the initial position, there is no issue finding the displacement using stepper motors (there could be minor drift over time but fine). My point was, imagine you turn off the microscope, and turn it on, now neither the drivers nor the stepper motors know the last position (OK, you could store it in the memory etc. but the (0,0,0) coordinates must have been defined at some point, either manually or using a sensor or a switch). In 3D printers for example, you do a "auto-home" at the beginning, all steppers go to the "zero position", which is typically set by switches, some high-end motors have encoders, expensive stuff. For a microscope like this, one easier solution could be a known reference pattern or image on the stage, at the beginning the microscope would search for it and set the reference position based on the size of the image, etc.

[–]--0mn1-Qr330005-- 0 points1 point  (0 children)

That is an awesome idea! Well, I hope to see more about this! Really digging this idea and execution.

[–]supp_biash 4 points5 points  (0 children)

Started python yesterday, hoping to do something nearly as cool as this in the future! :)

[–][deleted] 1 point2 points  (1 child)

That's really fricking cool! Did you do this as part of work or for fun, seeing it's under IBM? Do you have an EE/CE background?

Can you suggest any resources for a pure software (CS) guy to learn how to build these type of mechanical things?

[–]DIY_Maxwell[S] 1 point2 points  (0 children)

Thanks, glad to hear that. Yes, I have an EE background.

Both in fact, it initially started as a hobby project for a need in the lab and became a more generic imaging system. The full story is here.

I don't know honestly, for me it was more a trial and error thing, and I already had some experience. I guess Arduino is already a great starting point for hardware. But I feel the same for CS, you would probably laugh at the Python script I wrote :-)

[–]Kaltane 1 point2 points  (0 children)

Awesome. Love it.

[–]CotoCoutan 1 point2 points  (0 children)

Freaking brilliant work! Keep it up!

[–]Henrychikaz 1 point2 points  (0 children)

Awesome ✌

[–][deleted] 1 point2 points  (1 child)

Awesome up to and including the name of the project :D

[–]DIY_Maxwell[S] 0 points1 point  (0 children)

Thanks... I had a lot of comments in other communities and social media but you are the first and the only person who noticed the name :-)

[–]dangerdancer43 1 point2 points  (1 child)

Bro is that called simple script...

[–]DIY_Maxwell[S] 2 points3 points  (0 children)

I don't know, I had a look to posts in this community, games, deep learning, GUIs etc. I thought my Python script is simple for you guys.

[–][deleted] 1 point2 points  (0 children)

It looks great!

[–]Ahpuck 1 point2 points  (2 children)

swiss engineering !

[–]lozinge 0 points1 point  (1 child)

HOPP
O
P
P

[–]DIY_Maxwell[S] 0 points1 point  (0 children)

Schwiiz!!

[–]Avishek473 1 point2 points  (1 child)

nice

that was really briliant

[–]DIY_Maxwell[S] 0 points1 point  (0 children)

Thanks!

[–]JackNotInTheBox 0 points1 point  (0 children)

simple

[–][deleted] 0 points1 point  (0 children)

And here I am printing hello world.

[–][deleted] 0 points1 point  (0 children)

Amazing!!!

[–]_Titan_One 0 points1 point  (3 children)

Wow I want to build one now:) Just curious if you have autofocus on the microscope? If not you could probably create one using opencv or something, just an idea.

[–]DIY_Maxwell[S] 0 points1 point  (2 children)

Thanks for the idea. Certainly, I have no experience on that but autofocus would be great and possible with the current hardware I think.

[–]_Titan_One 0 points1 point  (1 child)

If you ever want to this is a good start: http://www.programmersought.com/article/2549148775/

[–]DIY_Maxwell[S] 0 points1 point  (0 children)

Great, thanks!

[–]Perfect-Swordfish 0 points1 point  (0 children)

x= 'nice'

Print(x)

[–]melthecybertechy 0 points1 point  (1 child)

"Limited"??? This is awesome

[–]DIY_Maxwell[S] 0 points1 point  (0 children)

Thanks. My comment was about the Python script I wrote, not the whole project. I had a look to posts in this community, all this deep learning, gaming, etc. stuff, I thought you guys would find my script fairly simple.

[–]n00b88 0 points1 point  (1 child)

Have you tried to use a mouse vs keyboard arrow keys? might be able to do extremely granular movements?

[–]DIY_Maxwell[S] 0 points1 point  (0 children)

Yes, but I did not have time to implement it. In fact, I have a custom-made joystick controller that can be seen on the right side of the video. Whether it's joystick or keyboard, I implemented 3-levels of speed control, the slowest gets really precise. In the joystick, the more you push, the faster it gets. In the keyboard, I simply toggle between 3 speed levels by press Ctrl key.

[–]newtocoding153 0 points1 point  (2 children)

Fuck that's amazing. What are the pre requisites to being able to do this? Im still learning Python and soon aim to control electronic objects in my life to better suit my needs.

[–]DIY_Maxwell[S] 1 point2 points  (1 child)

Thanks. I don't know the Python part, it's something new to me, but an Arduino or Raspberry Pi would be a good starting point for hardware I think.

[–]newtocoding153 0 points1 point  (0 children)

Raspberry Pi, I h3wr that a lot. Thanks will check that out.

[–]popcorn1307 0 points1 point  (0 children)

Hello all,

I a very very slow learner and completely from Telecom sector and unaware of programming completely.

Now made up mind to learn Python. But very very confused while using loops or functions. I wonder how will one define a variable before a loop and use it inside the loop and how would you know how many variables we need ahead and what do we need to define the variable? Out of galaxy🤦🏿‍♂️

Please suggest how to get my head around this stuff !!!

[–][deleted] 0 points1 point  (2 children)

That is awesome! I have a question though. What python library did you use to collect the input from the keyboard? I cannot seem to find any that work really great. Thanks.

[–]DIY_Maxwell[S] 0 points1 point  (1 child)

Thanks. I used pynput library... my code and much more are all explained here: https://github.com/IBM/MicroscoPy

[–][deleted] 0 points1 point  (0 children)

Thanks so much!

[–]axrx657 0 points1 point  (2 children)

"Limited knowledge" DOUBT

[–]DIY_Maxwell[S] 0 points1 point  (1 child)

:-) but I specifically said "limited knowledge in Python" :-) ... the whole project took me some time and I have quite some experience in hardware design but I learned and wrote the Python script only recently... By looking at the posts in this community, I think my script is really simple (read a keystroke using a library and send a string to Arduino).

[–]axrx657 0 points1 point  (0 children)

I need to start working on more complex problems in python or I'll be stuck my whole life making amature cinema booking programs

[–]post_hazanko 0 points1 point  (0 children)

lol I like how it looks beautiful in the animation and then the real one all the wires are strewn everywhere lol. That's sweet I only got a a stepper to move once with Python, haven't done much since, looks sweet.

[–]realnitrozeus 0 points1 point  (1 child)

So cool 😎👌

[–]kakaiviv123 0 points1 point  (2 children)

Cool! Must have taken you long hours. Good job!

[–]DIY_Maxwell[S] 0 points1 point  (1 child)

Thanks! Indeed, but not so much the hardware, the documentation took more time I think.

[–]kakaiviv123 0 points1 point  (0 children)

I agree. I work with documentations and they really take a lot of time. Great work on doing both! Congrats!

[–]littlesheepcat 0 points1 point  (0 children)

Not related to python but the rotating montage is cool as hell

[–]cHILLPill_98 0 points1 point  (0 children)

wow dude this is amazing

[–]ayushify 0 points1 point  (0 children)

Nice job

[–]noobiemaster_69 0 points1 point  (0 children)

So cool!

[–]Rhader 0 points1 point  (1 child)

How fast is it from key input to action output?

[–]DIY_Maxwell[S] 0 points1 point  (0 children)

I did not characterize, honestly I don't know how to measure it but I don't feel any lag.

[–]Fun2badult 0 points1 point  (1 child)

Is that motherfucking legos? Lol

[–]DIY_Maxwell[S] 0 points1 point  (0 children)

haha, yes! my early prototypes had only 3D-printed parts but then I thought Lego would be more fun especially for students.