Building an Autonomous Unmanned Aerial Vehicle

Earlier this year, I set my heart on building a drone that can fly itself. I know I’m not the best pilot, so I wanted something that could more-or-less take care of things on its own. It was (and is) a very long road, which started with me buying a Raspberry Pi 4B.

Since then, I’ve constructed a vehicle that can hold an extremely steady position a few feet above the ground. That’s about the extent of its autopilot so far, but that is a remarkable thing in itself. Your standard remote-control quadcopters may be able to “stabilize” themselves in the air, but they have no idea where they are in relation to the world around them and therefore can’t “stand still”. If the wind blows them, they’ll drift unless the pilot intervenes. It may sound like a small difference but it’s much more substantial when you’re working with precise movement in an area full of obstacles.

Let me also take a moment to say that if anyone reading this is encountering issues with any of the parts or workflows mentioned below, leave a comment and I’ll be happy to help out.


So, let me list off the salient components of my project (which I’ve christened W.A.T.N.E. — in honour of the character Mark Watney from the novel The Martian by Andy Weir.

  • The Frame – DJI Flame Wheel F450 ARF Kit. It came with motors, electronic speed controllers (ESCs), a sturdy set of arms, and a top plate + bottom plate.
  • The Flight Controller – Navio2. Most people opt to buy a standalone FC and connect a “companion computer” (usually an SBC like a Raspberry Pi or Nvidia Jetson Nano) over UART. I operated through the path of least resistance and got what I knew best: a Raspberry Pi Hat. RPi Hats are basically daughter boards that connect to the GPIO pins on the Pi and give it extended functionality. In this case, it’s giving my model 4B the capability to be an integrated 2-in-1 flight controller and Linux companion computer. I’ll talk more about the implications of that later, but please do read what I have to say before you invest in a Navio2 or any other FC that runs off the Linux stack.
  • Cellular Uplink: Netgear 340U USB LTE Modem. A rare find and a royal pain to configure for Linux, but I got there in the end.
  • Tracking: Intel RealSense T265 Tracking Camera. (Tests are underway to implement this device for precision landing.)
  • Obstacle Avoidance: Intel RealSense D435i Depth Camera.
  • Intelligent Object Recognition: Intel Neural Compute Stick 2 (not currently set up).
  • Radio Receiver: FrSky R9
  • Radio Transmitter: FrSky Taranis Lite with R9M ACCESS (long-range module).
  • FrSky SBEC
  • PiJuice UPS/Power Management Hat
  • 4S Li-Po High-Discharge Power Cell
  • Lots of cables, wires, connectors, Flex Tape, and hair ties.
The Big Brain Module
Using stacking GPIO headers and appropriately-sized standoffs, multiple daughter boards can be stacked.

I’ll be honest with you, I had little to no clue what I was doing when I started. My dad, who is an Internet Pioneer that founded this blog several years before my birth, raised me with an intermediate understanding of computers. However, this was hitherto my first foray into the world of UNIX commands. I familiarized myself with syntax by messing around with online examples aimed at kids. Like most things, you’ll find that the most intuitive way to learn coding is with the materials aimed at kids. I started off with Scratch by MIT just a few months after its release over a decade and a half ago.

When I thought I was ready to take on the big project (I was woefully misguided, but if I had known what I was in for I may not have started at all), I ordered the frame kit. That was my big initial commitment to the project. Assembling it was easy enough, once I got used to the soldering iron. You only need it for fusing the ESC cables to the bottom-plate. Pretty much everything else is plug-in if you play your cards right.

No alpha-build copter will look pretty. In my case, I had to learn that design work can only start once you’ve gotten it in the air.

It’s not hard to build a quadcopter. We live in a blessed era of over-information, we need only have the skill to discern the pertinent from the irrelevant.

  1. Flash an SD card with Emlid Raspbian. You’re stuck with their distro because the Navio2 needs a custom kernel.
  2. Assemble the frame kit. Only put the propellers on when you’re ready to fly it but make sure you know which props go on which motors.
  3. Assemble your Big Brain Module, in my case it’s a Pi and two hats. Oh, and put that SD card in there too.
  4. Connect the ESC wires to the servo rail, and the Navio2 Power Module to the port on the back-right corner of the FC. WARNING: I hate to be the guy to tell you that the boogeyman is gonna get you if you don’t eat your vegetables, but if you don’t follow the wiring diagram exactly, your drone will keep flipping when you try to take off and you’ll never know why. Trust me.
  5. Connect the power module to the flight battery. I mean, you can do it just to make sure power goes through it but all the motors will do is beep at you in a distressed fashion until it gets a data input. Maybe just leave it disconnected for now.
  6. Connect the power module to the bottom-plate. I use XT60 connectors and I had to solder an XT60 connector to my bottom-plate for the power running to the motors.
  7. Connect the radio to the port on the servo rail marked “1”. it’s the column of pins reserved for the only radio so don’t put your motors or anything else there.

That’s it for hardware, assuming everything was done right the first time. A lot of this stuff is trial and error, as it has been since time immemorial. Remember that everything you do is a result of the culmination of thousands of years of societal and technological research and infrastructure. We stand on the shoulders of giants, all of us. We are nothing without the efforts of our predecessors and keeping that in mind seems to temper me when my patience runs thin.

So far, I’ve described how to build something theoretically capable of flight. There’s not much to do software-wise, just some basic calibration done through the ground control application. I use QGroundControl but if you use Windows I’ve heard Mission Planner is way better.

If you configured everything right, you have yourself a remote control quadcopter. It should arm in stabilize mode even without a GPS lock (don’t get me started on GPS just yet).

In the next post I’ll go over all the tweaks and tricks I’ve done to make it do more than just be an RC toy.

Self Help

I’ve always been into optimizing so self improvement came naturally. I’ve listened to practically every opinion and doctrine, and you know that when you’ve heard more or less the same things in rotation over and over from self help gurus.

A friend once told me that I already had all the answers I needed. That was a wonderful revelation. We do indeed tend to discount our own counsel.

So after years and years of searching for more and having nobody come up with anything noteworthy I knew it was time to stop listening to everyone because they have nothing left to contribute.

My take away is:

  • Stop being a lifelong learner. Decide how much knowledge is enough. Then start integrating what you’ve learnt.
  • Listen to yourself, logically. Not self-indulgently. What you really want. You knew when you were 10 – they say go for what you wanted at that age. Likely because people reprioritize, losing sight of and forgetting what really makes them happy, instead pursuing their corrupt ideas thereof.
  • Have a sense of causality. It usually follows recognizing that one has agency, the privilege of choice, and the exercise of those choices causes outcomes for ourselves and others, both positive and negative.

25 Years and Browsing

My first single page site hosted on AngelFire, a free web host circa 1996, was launched this day 25 years ago, incidentally on World Health Day.

It was the starter web site of Eskay Business Service Centre (EBS), a family business providing executive suites and virtual office services. Business web sites being uncommon at the time, site visitors expecting an IT professional with specialized tools were surprised to learn that I was the Director of EBS and had authored the site in raw HTML using a plain text editor.

Keeping up with web browser technologies to provide an optimal experience became a thing of the past with content management systems so now we can focus on quality content rather than design and compatibility. Though I’m surprised that to this day there is no standardization of the favicon across devices and operating systems, which is why I present to you an all-new favicon set optimized for specific devices as a tribute to the past and in celebration of 25 years.

bajaj.com is 23

bajaj.com now 23 has gone through several technology changes since its humble beginnings in 1997, as an information portal about the family. Here’s an overview for a journey through time for those that missed it:

  • A throwback to the InterNIC and Network Solutions era, registrations used to be $100 USD for 2 years.
  • This site was initially hosted on shared servers, moved to self-hosted, then developed into a blog circa April 2008.
  • The hardware and software that it has continuously run the longest on (from December 2004 to April 2019) is a Dell PowerEdge 700 with an Intel Pentium IV processor running WordPress on FreeBSD.
  • It built equity in terms of listings on portal sites, search engine popularity and links from other sites, that briefly attracted advertising in 2009.
  • The site is additionally accessible over an IPv6-only network.
  • Currently (since April 2019) it remains self-hosted on a Synology DS 1019+ and supports HTTP/2.

Self Love

My journey into self love has been life changing.

It began with being made to realize that I was bestowing the kind of love, care, attention and financial benevolence I’ve always craved, on people I love, as an attempt in satisfying my own need for affection. That’s what I learnt growing up, to go out of your way to help people who have not had your advantages in life. “Be generous with your time and energy.”

I might be famished by the time I get to the tenth person and still be wondering why I keep getting hungrier. Which then begs the question as to how can I ever hope to have a full stomach if every time I am hungry, I feed a loved one? The answer is likely rooted in my belief that, “love begets love”; and apparently that belief has not served me well because while I am famished I feel a sense of fulfilment because feeding others has been somewhat therapeutic, and this state of starvation while simultaneously feeling satiated is not sustainable.

I received this feedback when I shared my thoughts, and that finally got me unstuck —

You are just desperate for company, love and for your loneliness to go away so you give a lot of what you need because that’s your perspective, and you give it because you think that’s what everyone needs too
But you don’t get it back
Because the truth is that’s not what everyone needs
Or wants

Wow, time to reevaluate my beliefs and the saying, “Do unto others…”. What am I doing unto myself? Everything in excess is poison, even giving of myself to the point that my emotional investment breaks my bank when I feel unreciprocated. In that regard, I decided to do —

  • only that which makes me feel good about myself
    Reducing how much I invest in people, especially in those that don’t bring value to my life, or worse still, make me feel less than satisfied with myself.
  • in only as much measure as I can emotionally afford
    Not over-stretching myself in time, effort and money as these are all means of getting emotionally invested. Once the investment is less, it’s easier to adopt the “send and forget” strategy I use for e-mail (viz. deleting the message from my sent mail so I forget having sent it before it gets filed in long-term memory), and delete all memory of having made the investment. That way you’re not expecting dividends as in you’re not awaiting reciprocity you might never get, and can move on with your life, and it’s easier because the investment was from your emotional petty cash.
  • unto myself as I would do unto others
    Which is, to protect, nurture and pay heed to the needs of my inner child like a loving, caring, affectionate and doting parent.

Which then begs the question, is that the right thing to do? My go to is this blog post from which I have derived that right and wrong are societal constructs whose definitions are constantly changing, so I am not afraid or embarrassed to follow my internal compass. When I brought this up, I was asked with good reason, “But isn’t embarrassment a reflection of social constructs, rather than good or bad?” Fortunately I am privileged enough to not have that to worry about, as I answer to no one but myself.

So armed with recent beliefs that —

  • doing what pleases me seems to be the only “right” thing to do, if my other beliefs are true that
  • the purpose of life is to be happy, considering
  • life is random and
  • the only consequences in life are those that we wittingly or unwittingly bring upon ourselves through our exercise of our power of choice,

I have decided to not be collateral damage in another person’s story.

You may be justified in feeling hard done by, especially if you have done things for others that don’t seem appreciated, but don’t waste time brooding about it. You are captain of your ship of fate, so it’s your responsibility if you’ve been sailing off course.

Good vs. Evil

To understand morality, a baseline must be established. Humans in their natural state are neither good nor evil, but that doesn’t mean that “regular humans” wouldn’t perceive some of those neutral actions as ‘evil’. For example, a toddler in kindergarten who has not been taught manners will take toys from another child without asking, as this is the way of the wild. People would interpret the action of “stealing” the toy as evil, but that is just because they have already been conditioned by society. The alpha-wolf gets to eat first because it is stronger. It is capable of taking the food from the weaker wolves. Toddlers are, in a way, animals. If left to their own devices without intervention from authority figures, toddlers will eventually form a hierarchy of sorts, the strongest child having all the toys and food it wants. On another hand, primates kept in captivity have shown signs of humanity after being surrounded by “properly conditioned”, normal humans. Wolves are not evil for asserting dominance based on strength, nor can unconditioned humans be considered so. Upbringing is the conditioning humans go through. During the upbringing, basic moral grounds are set. The conscience is brought about, and children are taught fundamental differences between right and wrong. Studies have shown that the conscience and all moral thought is cemented before the age of five. If a child is not taught the fundamental differences between right and wrong during that time, they will be generally considered evil by society.

How, then, can one truly tell what is good and just? Steve Taylor, Ph.D. defines it as “‘a lack of self-centeredness. It means the ability to empathize with other people, to feel compassion for them, and to put their needs before your own. It means, if necessary, sacrificing your own wellbeing for the sake of others’. It means benevolence, altruism and selflessness, and self-sacrifice towards a greater cause – all qualities which stem from a sense of empathy. It means being able to see beyond the superficial difference of race, gender, or nationality and relate to a common human essence beneath them.” (Taylor) Continuing on Dr. Taylor’s train of thought, the character known as the Doctor from the TV series Doctor Who recently said, “hate is always foolish, and love is always wise.” (Moffat)

Taylor, Steve. “The Real Meaning of ‘Good’ and ‘Evil’.” 2013. Psychology Today.

Does God Exist?

Does God exist? As long as the concept of an omniscient and omnipotent overlord has existed, the human race has asked the question: “Does God exist?” It can be argued that this is the oldest question in the universe. However, I disagree. I think the oldest question in the universe (or at the very least, the first question that any being would ask as soon as they are capable of thinking) is “why?” This question can be found at the root of every science, philosophy, art, and religion. It is the explanation for the modern interpretation of God. In The City of the Shadow Realm – a novella I wrote – an ethereal character states, Religion is a construct of the human mind that was designed to help them cope with their fast-growing intelligence. Thousands of years ago, when humans were beginning their climb in the scale of knowledge, they started to ask too many questions to which they were unable to acquire answers for. They invented religion to explain away phenomenon they couldn’t grasp. (Bajaj, 2016)

As I stated, the “God” many religions have come to accept does not exist. It was and is an explanation to something beyond limited human understanding. The Greeks were one of the first recorded civilizations to practice religion. They believed that Zeus was responsible for thunderstorms, and Poseidon caused tsunamis. They invoked the name of Ares when going to war, and blamed Aphrodite for love. For every phenomenon they did not understand – every time they asked “why?” to an unanswerable question – there was a God to explain it. This, in my opinion, was nothing more than a fallacy they told themselves, because human nature cannot handle a question without an answer. I would not go so far as to say that there is nothing beyond death, and I still believe there is some form of transcendent energy that controls the universe. However, I do not think there is a corporeal, sentient, or even conscious God as depicted in Christianity, Islam, Judaism, etc. I believe God is energy, a primordial spiritual power that exists beyond time and space. God is a law of nature, and is nature itself. God exists to be called upon by the beings of the universe. In The Secret by Rhonda Byrne, the Law of Attraction is elaborated upon, described as energy in the universe. Byrne states that “Your power is in your thoughts, so stay awake. In other words, remember to remember.” (Byrne, 2006)

To paraphrase: our thoughts create reality. We can imagine our lives the way we want them to be, and it will happen. Is this not how God is commonly thought of? People go to places like churches, mosques, synagogues, temples, and shrines to pray: asking their God for the things they want and need. In my opinion, there is God in all of us. Every being that has ever lived has had God inside them. This is because God is thought, and thought is God. People do not need to go anywhere or pray to any specific being to ask of the energy we call God. However, one should not ask for anything. If you ask for something, it means two things: you do not have what you are asking for, and you are not showing your gratefulness for what you have.

When you want to attract something into your life, make sure your actions don’t contradict your desires. Think about what you have asked for, and make sure that your actions are mirroring what you expect to receive, and that they’re not contradicting what you‘ve asked for. Act as if you are receiving it. Do exactly what you would do if you were receiving it today, and take actions in your life to reflect that powerful expectation. Make room to receive your desires, and as you do, you are sending out that powerful signal of expectation. (Byrne, 2006)

So, am I an athiest because I don’t believe in a God? Or am I a thiest because I believe in some manner of higher power? It is not as simple as that; I would define myself as an agnostic non-deistic thiest. That is to say, I believe in a God (I am a thiest), I do not believe that God is a deity (non-deistic), but I’m not one hundred percent sure of my beliefs, and I accept that fact I could be wrong (agnostic). To conclude: I believe in a God, but not in the traditional sense.

Works Cited
Bajaj, Satraj Singh. The City of the Shadow Realm. 0.4. Vol. 1. Toronto, 2016.
Brietbart, Peter. Atheist, Gnostic, Theist, Agnostic. 2009.
Byrne, Rhonda. The Secret. Ed. Rhonda Byrne. Beyond Words Publishing, 2006.

Doing the Minimum

It’s disappointing when doing the minimum one needs to do to get paid, and reliance on the insurance industry to pick up the slack when one fails to do even that, becomes normal. But it’s worse when, rather than showing the moral courage and owning up to it, one uses lies, rudeness and offences to cover up one’s incompetencies.

Doctors need to have skills greater than the sum of the books they’ve read. Even a simple computer program can look up diagnoses and prescribe medication per established protocol by following a flowchart; and AI can probably do better than most consulting doctors. I came across an elderly person who lost the use of his legs because five doctors all came up with the same wrong diagnosis. It seems that either their need to respect each other’s professional opinions exceeded the need to correctly diagnose the patient’s health or they were all equally incompetent and looking up the same book.

Lawyers take on more and more business while actually doing less and less work, most of which is delegated to law clerks who in turn do the same, due to the safety net of making the client pay for insurance, so if anything goes wrong in a transaction, including due to their incompetency, they are not only safe, but actually get paid by insurance for more of their billable hours for filing the claim for the client to get reimbursed.

Banks are similar. They actually do not check the signatures on cheques under $1,500 due to the volume of cheques. If they do wrongly pay out a cheque, and provided the client notices, they have 30 days to recall the funds they incorrectly paid out (if it was to another bank), failing which there’s insurance to reimburse the client.

Insurance brokers make a killing on fear mongering, like there isn’t enough of it already. First pay premiums to cover the various risks, then not file a claim in the event of a loss, so as not to risk being dropped by the underwriter for filing the claim. Because being dropped by the underwriter would end the recurring revenue stream for doing pretty much nothing after first raking in the client.

“Professional” is a word that gets thrown around a lot in almost every context. Everyone considers themselves a “professional” in the sense that they are highly skilled at their craft and conduct themselves in a commensurate and ethical manner. To me that word simply means a person who charges money (as opposed to amateur) for whatever they have managed to make a go of in their lives.

I could go on and on – from people offering to help (for a fee, of course) to so-called “professionals” and businesses, everyone seems to be in a race against time to amass as much money as possible while doing the bare minimum possible.

Is Knowledge Detrimental?

When people ask the question “can knowledge be detrimental”, I always think about how ironic that is. If knowledge really is detrimental, then even the knowledge of that is detrimental. It isn’t as simple as that, however. There is a saying: “ignorance is bliss”, and to an extent, that is true. For example, if someone is bad at keeping secrets, then they shouldn’t know something of a sensitive nature. The secret-keeper will feel burdened by the secret, and the secret-giver will be hurt if the secret is revealed. The secret might be for the benefit of a third party, who will also be hurt if the secret is revealed.

In the popular anime/manga series Attack on Titan, humanity lives within a walled city surrounded by man-eating giants known as Titans. The residents of the wall have been living there for a mere century, but believe that they have been there for much longer. Furthermore, they believe themselves to be the last of humanity and completely isolated. They don’t know, however, that they are merely on an island off the coast of Marley, a country who they (the island of Eldia) lost a war to 100 years ago. The king of Eldia modified the memories of the Eldians and marooned them on the island, completely isolating them from those who would seek to harm them. The king obviously thought that the knowledge of a world beyond the walls would be detrimental to the people of Eldia, so he shrouded his citizens in blissful ignorance.

Another example would be the series of novels written by Jeanne DuPrau; specifically, The City of Ember. Ember is a city located deep underground the Earth, hidden away and populated by people who were raised not knowing there is a world beyond the cave in which they dwell. The City of Ember was created by the Government as a contingency plan for human survival, in the event that the impending nuclear war would wipe out the rest of the population. The first generation of Emberites were instructed to raise their children to know nothing of the world above, so that they would not try to surface from their safe underground dwelling prematurely. Once again, the government officers in charge of the Ember project decided that knowledge would indeed be detrimental.

However, in both of these examples, there was a flaw in the plan. In Attack on Titan, the Marleyans sent undercover soldiers to destroy the walls of the city and let in the man-eating Titans. The Eldians were blindsided and massacred, not prepared for an attack and unaware of what to do. If they had known about Marley, they’d have been able to expect an attack and prepared. In The City of Ember, the time capsule (containing instructions on how to exit Ember and knowledge of the world above) set to automatically open well before the Ember supply stores ran out, was misplaced and not found for hundreds of years later. The lack of knowledge put the entire population of Ember at risk. The city was on the brink of electrical failure (which would plunge them into absolute, deadening darkness) and their food supply war running low. It was a fluke that the protagonists found the capsule and led the city out of the long-past-due-to-fail Ember.

In conclusion, knowledge can be detrimental, but one must consider the implications of ignorance too, which can be equally harmful.

Bigger Better Deal

People hold out for “the bigger, better deal” which explains why if you won’t settle, you don’t settle. Not that there is anything wrong with being single; it is in fact the best way to drive family lawyers, marriage counsellors and such parasites out of business.

The problem arises when we start looking for a connection to last a long time rather than revel in it in the moment; that is crazy. We are in this world temporarily, like on a train. We cross paths for even shorter times with fellow passengers. A person we meet at one station gets off at another, or we get off first.

We need to accept life as a train ride where passengers go and come wherein we engage our best for however long we have each other’s company and accept that one of us will have to disembark sooner or later.

If we are like we are today, with our faces buried in our phones rather than talking to each other just because the person sitting next to us is not “the one” (like we would know anyway with our faces buried in our phones), even that little time we have to engage is wasted in waiting. So stop waiting and reach out to everyone, and they might be the one or one of many people who will enrich your life. There are no bad relationships; you are richer with every one.