Skip to main content

Posts

Showing posts with the label Arduino

Matlab to C/C++ code development - Some learning points

Over the last few years, the engineers at the company have invested both their time and sleepless nights in formulating a process for the development of Machine learning algorithms that will satisfy real-time constraints with minimal RAM usage. This is quite a tall task as per default, that would force one to do their development directly in C language. Although that seems like the right choice, the downside is the direct correlation of the debugging time with algorithm complexity.  Such a time could have been rather used in optimizing the algorithm within the MATLAB environment which has excellent tools for the analysis, plotting and debugging. So it was decided to rather learn the Code generation process with the hope that future algorithm could be designed in a similar fashion without the hassle of the compiler-specific run-time issues. The development of this machine learning algorithm would eventually be implemented in a 32bit, 160Mhz speed, 260KB RAM microcontroll...

Folding arms on my quad - A game-changer

So i've been looking over the last few months how I can get to fly more of my quadcopter drone for both research and leisure. The major drawback of the 1.6kg drone is its form factor at the time. Being a H-frame quad with cross rotor length of over 80cm, I had to purchase 110L storage bin to keep it safe and damage-free. After much research I ended up a natural solution that would involved just a steel saw and good eye for detail. The other (obvious) requirement for this folding mechanism is that it should make the deployment time as fast as possible with a few if not no special equipment. This led the the solution of cutout the area around the second bolt of each arm to allow pivoting action on the first bolt. The cutout should also be such that bolt hole remains to be used as a stopper to maintain symmetry along the quad x and y axis. The high contact friction will be used to ensure the arms remain in the required position throughout a particular flight. After much sawing and...

Raspberry Pi or Arduino Uno? One Simple Rule to Choose the Right Board

Here at  Make:  we see new, ingenious projects from our community every day. Many of these are made possible by the use of development boards. However, if you’re new to the subject, it can be confusing to parse out the differences between boards and the advantages of using one over another. We’ve created this super simple guide to help you get started. Then, when you’re ready check out  Arduino Uno  and  Raspberry Pi  Starter Kits, which come with all the goodies you need for your inaugural projects. Not sure you want all those peripherals yet? Start with the essentials: Grab the board of your choice and bring yourself up to speed with our  Getting Started With  series for  Arduino  and for  Raspberry Pi . Courtesy of  Tech Uni What is the difference between the two? An Arduino is a microcontroller motherboard. A microcontroller is a simple computer that can run one program at a time, over and ov...

Blade 300CFX Flight log 5/100 - Failures 1/100

Another succesful 4:30 min of tail-in and side to side hover flight. Accumulated time: 21min. I found it quite difficult with wind to stay at a consistent height, I landed the heli twice and I should have made changes to the throttle/pitch curve or the mixing. It was quite challenging flight in hover in gusty conditions but I'm finding keeping the heli in the air longer much easier. Next is to slowly transition into face in and then nose in (although I feel I'm more comfortable nose-in). In the meantime, I've started working a instrumentation platform that will be integrated between the landing gear and the frame of the heli to hard gathering data. That should bring about more result-orientated fun!

Modifications to the automated sprinkler device

So I finally found an enclosure for my automated sprinkling system. It uses a photocell for day/night switch. I'm planning to add two potentiometers to control duration and repetition without flashing new code. A master switch that restarts the program will also help. Will post some videos on how it works. EDIT: Managed to add the master switch on the microcontroller. Given than the solenoid in Normally-Closed, the master switch prevents the current to drawn by the solenoid. #coding #atmega328 #uav4africa via Instagram http://ift.tt/2f1G7or

Navigation algorithms now include Drift compensation PI controller

So it turns out that I was very optimistic about just using a gain mixing of accelerometer rand gyros than computing a DCM matrix of the aircraft rotation. So I decided to overhaul the code by creating data structures that will hold the information requires for such computation. I must say that at the back of my mind I was really worried about the computational time that these calculations will take in the small Atmega328 micro. To my surprise, provided that one sticks with a minimum of division operands, float arithmetic is actually quite fast even in an 8-bit controller. Given that this application is for high L/D aircraft and who’s mission is mainly waypoint tracking, the slow changing dynamics can be reasonably captured with this environment. The bad part of the implementation was to discover how quickly the gyro drift (especially in the roll channel) hurts the computation of the Euler angles. (See the pics below), even-though all sensor are bias compensated fro...

The use of floats/doubles with AVR assembler

So I've decided with the change of the DCM matrix and PI controller for navigation to change fundamentally the code layout with the use of data structures to make more sense of the information been passed on. I also spend most of list night trying to get my head around whether float division is really such a problem. We'll based on references xxx and xxx it is. Float memory allocation is not a real issue but float division can really boggle down your code to the core of tortoise pace. So this reference xxx explains that one can find an alternative around this issue which should speed things up quite a bit.The fact of the matter is that float division should really be an exception in any type of code (irrespective of the compiler and host). A lesson well learnt.

No more resisting the market trend. I'm developing a quadcopter

Yeah that's right. Everywhere you go, including some intern projects at my company, quadcopter drones is the current trend. The marketing success is simple. It's a lot cheaper and less complex and than a comparable RC helicopter. They're virtually no mechanical moving parts (expect the platform itself). And it's perfectly suited for camera attachment. So hot combination has spawned the quacopter drone revolution. I've always been against following a trend just for the sake of it. But considering that I need perfect weather test fly my flight controller only makes sense to start modifying my code to accommodate for a quadcopter. The controls are pretty straightforward and the design is incredibly simple. Another design dev coming up!

It finally clicked!

So I had a brainwave the past two days in how to test various aspects of the autopilot modes without having to land and flash new software. It became very frustrating that for each morning, I had to land the aircraft 5-6 times and increase the risks crashing and even worse loosing the instrumentation on board the glider. This approach could potentially allow me to analyze various options of flight modes and optimize which one best suited for that function. The ultimate goal is of course, the speed at which each flight modes can tested. So I manage to devise a method that allows me to use a switching mechanism such that I can switch between each programmed flight modes by using transmitter only. The code was tested and seems to work just fine. Now it's just a matter of testing in flight.

Glider Airframe Modelling for Flight Controller design

Due to the past 2-3 months of bad rainy weather and gusty winds, I've decided that it was time that I invested in a tool that will be able to give me preliminary understanding the flight control is a scientific way . That means I will have to acquire a mathematical model of the airframe and use the current hardware to form a In-The-Loop Simulation (HILS). My approach for this will be to use DATCOM to derive aerodynamics parameters then coding the equations in C. This will then be flashed unto a separate Atmega microcontroller and will talk to the the rest of the hardware via the serial interface . The accelerometers and gyroscope values (superimposed with errors and biases) will be then form part of the output from the airframe model which in turn will exercise the flight controller and mission controller. What's not sure yet is how to test completely the waypoint tracking algorithm without using the GPS hardware. One way was to have a simulated GPS module as part of t...

GPS Navigation Ground Test #1 - Waypoint Tracking Algorithm

So after a period of absence of over a month (feel depressed everytime I say it), I got back into the groove of things. Decided not to wait to get back on the field to test the pitch and roll autopilot and decided to start working on the waypoint tracking algorithm . The advantage of having your own home with a garden is that you no longer struggle to get a GPS lock (There's no more concrete flats surrounding us yeah!!!). So got familiar with my gear again. Also decided to buy a piezo buzzer that could be used as a replacement of the serial monitor. The aim was to increase the intensity of sound as you got closer to the next waypoint. In such a way you will know if you're going the correct way. Decided to use GPS Visualizer to get waypoints on the property. Re-formatted the points into the code uploaded it onto the controller. It must add that I managed to successfully run arduino from the linux command line and use the program screen as a serial monitor. Not only is it m...

Flight Data Results

We've been having quite bad (windy) weather that It has been almost impossible to get the glider up in the air to gather more flight data . But nonetheless, I managed to analyse the data that I have come to some interesting conclusion on the behaviour of the aircraft in flight. The post-filtering of the IMU euler angles prior to controller design only add approximately 4/10th of the second in lag (guestimate). The servo limiter which I set on all channels is which what a normal flight actuation is experienced (considering wind factors). It's quite clear from the graphs that GPS velocity is expected to change with aircraft pitch although the nature of the sensitivity over a 1Hz update was not expected. The noise factor in launch in both roll and pitch channels shows that an alternative method needs to be established for a take-off and landing autopilot mode. There seems to be a considerable lag in pitch servo input and pitch change. This makes sense for the fact that t...

Initial In-flight Testing of autopilot SUCCESS!

Depicts a traditional PID controller. (Photo credit: Wikipedia ) I'm such an exciting right now. It's been over a year of putting this UAV glider with custom autopilot and electronics together and now we're at the pivotal stage. In-flight testing of autopilot and GPS waypoint tracking!! Decided to go for a flight test on Sunday morning before church (around 7am) eventhough I was performing the church band that morning (crazy I know). It was bitter cold but decided to push through. I must say that I realised that I need a small collapse table/stool to setup the instruments instead of the wet/moist ground. I was great to see that the transmitter code works as expected. There was no lag in the transmission of signals from transmitter -> autopilot -> servos. The turning of aircraft with rudder and elevator control was smooth and consistent. It was refreshing to see that the filtering algorithm worked well. Decided to test the roll autopilot first, this...

Updated filtering algorithm from transmitter

The Dx4e transmitter (currently that's what I'm using) creates alot of noise when used with arduino. It's quite clear that the receiver has a tuned low pass filter that needed to be emulated for the code. A low pass filter was implemented with a stategy of using a the gradient of 3 values to determine whether allow input to the servo signal stream or not. Here's the pseudo code below: