We explore all kinds of technologies, starting from programming, electronics ending in the photography sector. A bit for everyone.

Thursday, October 22, 2020

Dynamic Programming Explained Simply in 100 Seconds

Dynamic Programming is just a fancy way of saying memoization or caching - remembering stuff to save time later. If you have already computed a function, map the given parameters to the result, and you can use this information later without calculating the whole function again if the parameters are the same.

Those who cannot remember the past are condemned to repeat it. - Dynamic Programming


There are two ways of using dp, one in recursion and the other in iteration


It’s easier to write it in recursion since each time the function gets called you can check whether it’s calculated before.


But often, you will see the iterative approach used because recursion usually takes a lot of stack memory.


For a better understanding of these two approaches, check out the 100 seconds of DP.



Dynamic Programming sounds scary to beginners in competitive programming, but this is the video I wish it existed when I started practising DP. It's a really helpful technique all the time!


Hope you have enjoyed the video!


Share:

Thursday, July 23, 2020

DIY Wireless Follow Focus

Is it possible to build your own homemade, but powerful and feature-packed follow focus? Let's find out!

Youtube video: https://youtu.be/NZtYzvitv3U



The components that I have used include:
  • Nema 17 (but don't use it, I'll explain later!)
  • Driver for the motor
  • two Arduino Nanos
  • two NRF24L01 + PA + LNA
  • Booster if you use 3.3V battery
  • Potentiometer (make sure it's a LINEAR)
  • Plate from SmallRig
  • Rod and Clamp for mounting the motor
  • two generic plastic electronic enclosures

Motor

Regarding the motor, I REALLY don't recommend using the Nema 17 because it's way heavier than it should be. Said that you should look into servo motors from eBay which have their own reduction mechanism. It will allow you to drive heavy lenses but the motor will be way smaller and lighter. If especially you have vintage or Cine lenses, these are designed to be driven easily.

With my setup, I can only use it with the Ronin-M. It does support it but becomes very heavy and hard to use.


Transceiver Module

The other thing you should know is not to use these cheap transmitter/receiver modules, but to invest a dollar or two more into the NRF24L01 + PA + LNA. Even the ordinary NRF24L01 are not good enough for a few meters. Believe me, I have tried them all :/


Potentiometer

Potentiometer choice is also very important. Make sure it's a linear potentiometer between 10K and 100K. I chose a 50K Ohms. You may notice a lot of variation in the voltage that the Arduino will be reading. This is bad. To negate this, you will need capacitors close to the Arduino's powerlines and the Transceiver module. Also, if this doesn't help, you will need to average a couple of readouts from analogue pins over some time. This will certainly help you in the long run.


Don't do it?

In conclusion, If you are looking to beat Tilta or DJI in the weight category, you've already lost. Of course, the money difference is big, but still, if you do this professionally I would recommend going with a factory solution - it will save you from the sweat in the long run. It took me quite a long time to make this. I have posted the code in the Youtube video's description!

If you have any questions regarding my solution, post them below. Make sure you watch the video and hope you have a great day!
Share:

Thursday, March 26, 2020

MemoryRouter and Material UI Navigation

Are you wondering why your MemoryRouter and Navigation from Material UI don't properly work?



Maybe your <BottomNavigation> gets messed up when it's wrapped by a <Link> from react-router-dom?

It took me one day to sort this out. The official documentation of the Bottom Navigation (Action) from MUI is non-existent.

First, you must know that the MemoryRouter is rarely used, because of the server's inability to redirect you to a specific URL. (The URLs are all stored in memory)

However, when you want to use it, here's how to do the Links properly.

return (
    <MemoryRouter>
        <ThemeProvider theme={theme}>
            <Switch>
                <Route exact path="/">
                    <SubjectSelector />
                </Route>
                <Route path="/score">
                    <Scoreboard />
                </Route>
                <Route path="/contribute">
                    <Contribute />
                </Route>
            </Switch>

            <div class="navbar-container">
                <BottomNavigation
                    value={this.state.currentPage}
                    onChange={(event, newValue) => {
                        this.setState({ currentPage: newValue });
                    }}
                    showLabels
                >
                    <BottomNavigationAction
                        component={Link}
                        label="Choose"
                        icon={<SchoolIcon />}
                        to="/"
                    />
                    <BottomNavigationAction
                        component={Link}
                        label="Play"
                        icon={<PlayArrowIcon />}
                        to="/play"
                    />
                    <BottomNavigationAction
                        component={Link}
                        label="Statistics"
                        icon={<BarChartIcon />}
                        to="/score"
                    />
                    <BottomNavigationAction
                        component={Link}
                        label="Contribute"
                        icon={<AddIcon />}
                        to="/contribute"
                    />
                </BottomNavigation>
            </div>
        </ThemeProvider>
    </MemoryRouter>
);

You need to pass the <Link> class as a component prop for the BottomNavigationAction. This way you preserve the integrity of the parent component without disrupting it's CSS classes.
Share:

Contributors

Powered by Blogger.