Thursday, July 2, 2020

Algebra for beginners

My own little way to help our students cope with the Covid-19 pandemic.  Stay safe, continue to study with me, and thank God that we are still ok.

Wednesday, July 1, 2020

It's Been a While...

How this pandemic has changed the world!  May you all be in good health and good spirits.  Be strong and keep believing this will come to pass somehow, sometime...

Thursday, September 17, 2015

How to add intelligence to our homes? - Part 2

This is the long overdue update of the house project conceptualized a while back with my kids.  In this project, a model house was wired for simple lighting using LED's.
 
The USB home
Each part or room in the model house will be lit by a dedicated LED and each LED will be directly connected to the pins of the microcontroller, in this case, the Arduino Uno.
 
The Arduino Uno wired using a recycled IDE cable


The Arduino being wired
The Arduino will act as a hardware controller/driver to power up the LED's but commands will come from a PC.  This whole architecture can be ported to a real, full sized house and control is not limited to lighting only but for the purposes of demonstration, the model house should be sufficient to illustrate.
The GUI in a Windows PC



The GUI showing the check boxes and sliders as control inputs

The model home is connected to the PC via the USB port.  The Uno will function as a slave unit with the PC as the master.  If a user clicks on the GUI, the corresponding LED will light up (or toggle off) in the actual model home.  This therefore illustrates how a real USB controlled home can be made possible.

The power through

Power lines
High tension power wires bring electrical energy across vast distances for distribution to the end users.  They play as the major energy conduits of today's civilizations.  With the advent of information technology, the world's hunger for electrical power became even more resounding.  So what makes this system work?

1.  AC is used instead of DC.  AC allows voltage transformation.  This means that the voltage can be varied with the use of a device called a transformer.  A higher voltage is used for transmission versus the lower voltage used in distribution.  Why is this so?  This leads us to point number 2.

2.  As power (P) is the product of voltage (E) and current (I), for the same power transmitted, the current can be lower by using higher voltage (P= IE).  A lower current means smaller diameter transmission cables.  This translates to lower investment costs for the cables.

3.  The consequence of higher voltage however is the difficulty of isolation or insulation.  If the cables are too near each other, it can cause arcing much like a lightning bolt.  Thus the cables are raised high above ground and are spaced far apart enough.

Modern electrical transmission systems are more complex than it seems.  There is normallty a grid designed to take in power from many source generators and distribute the power across multiple load points.  All these complications are taken cared of by engineers so that we can live our lives comfortably and with all the power we need.

Wednesday, December 25, 2013

Line tracking truck upgraded

Well, it's Christmas and the kids and I have more time together.  We exchanged gifts and I got this gift below.  This is a collection of comics pages from newspapers!  :-)  This is probably the funniest I got so far so I can really look forward to the next year and be excited about what to expect again next.



After the gift giving part was through and the funny talk has subsided, we were back to the line tracking truck project.  After the code was tested and optimized for actual runs (considering motor speeds and sensor feedback triggering, etc), it was time for some UPGRADE.   One interesting upgrade is how to incorporate a reasonable degree of recovery in cases of overshooting the line.  Thus, a "recovery" routine must be integrated into the code so that the truck will try to "look for" the line back once an overshoot is encountered.  Several code modifications were needed to make this workable.

1.  The overshoot should be minimum.  Thus a quick stop code is to be designed to react quickly once overshooting is detected.
2.  Overshoot must be defined.  The idea is to try to recover from a turning overshoot.  If the line/tape ends in a straight line, the assumption is that the end of the line is reached and no need to "recover."  However, if the overshoot happens in a turn, the truck should try to get back into the path.
3.  There must be a limit to the recovery procedure.  If after a certain number of tries, success is still not achieved, the truck should stop trying in the end.


In this upgrade, the truck was already provided with an auto-detect function.  In the previous run, the tape was white and the floor was dark.  This time, black "tape" is used against a white floor.  The truck will auto-detect a bright or dark floor and then use that information to sense the line/tape.  If it cannot calibrate, it will flash an LED so the user will know that a calibration error occurred.  A manual reset is needed (so it can try to calibrate again)


Looking for a black tape however was not as easy as I thought.  I cannot find a black tape at home wide enough for the sensor spacing design and stores are closed for the holidays so some improvisation was required.  So finally, some scrap black strip and a laptop bag strap were used for the testing.  A bend was introduced into the path so that the truck will overshoot on purpose during the execution of the turn.  If you remember, the minimum turn radius of the truck is only 2 feet.  The bend below is definitely with a much smaller radius than the supposed smooth turn of 2 feet. 


To come up with the logic of the recovery, the assumption was that there must be first a "detected" turn event.  This will be the basis for action.  The recovery will involve a reverse move with a matching steer to the opposite direction.  (the steering for this reverse motion is currently set at 10degrees only)  The truck then will stop at an instant of tape/line detection.  This is the desired success criteria for the recovery procedure so that the truck can go back into tracking the line.  If the truck cannot find anything after a certain number of search cycles (this time it is set to 5), the failure will be acknowledged and the search will stop.


After several erroneous codes and some funny truck behavior, the serial monitor was used (and abused) to understand where the erroneous values came from.  Then it was found that the sensor values in the "recovery" routines were conflicting with the initial calibration logic and modifications were made for consistency.  The timings for the quick stop motion was also not right.  In the end, for the truck to stop, I have to introduce a reverse motion at full motor power for 500ms.  This is enough to "kill" the momentum but not enough to cause much reverse movement.


Finally, below is the video of the truck overshooting and trying to recover.  Notice how it stops and reverses in the bend, then recovering back to tracking the line.  Then, it makes a quick stop after the line ends (this time in a straight line fashion). 


Merry Christmas to all.  May God richly bless everyone and more projects to come for 2014!

Saturday, December 21, 2013

Line tracking truck update

This is a sequel to the line tracking truck project previously posted.

Calculating minimum turning radius:

By design, the steering front wheels can turn by as much as 18 degrees.  The wheelbase is measured at 185mm.  Based on design geometry, we calculate "r" as the minimum turning radius of the truck.  At maximum steering angle of 18 degrees on a wheelbase of 185mm, the minimum turn radius is calculated as per below to be around 600mm (2 feet). 


Thus, by mechanical design, the minimum turn radius that the tape can be laid out so that the truck can follow without overshoot is at 600mm.  A bigger radius or curvature will of course ensure that the truck will not overshoot in the turn.

This seems to be a reasonable design limit so the project can proceed to reality.  Using the same electronics already built into the truck in the light seeking truck project, we just modify the software inside the microcontroller to make this work.  This time, we will make use of the 4-channel IR sensor that was previously installed in the front bumper of the truck.



The first prototype of code made a lot of overshooting.  The steering cannot cope up with the forward motion thus causing overshoots.  As there are four sensors in the front of the truck, the logic was programmed to be as follows: (values were made by initial performance estimates)


To make sure the steering can compensate, the code was optimized for minimum cycle time.  The faster the code can run, the more that the truck can stay on the tape.  After corrections, the prototype code was ready to run.


The next development to this project is overshoot correction and recovery.  That can be a little tricky but that will be available soon.  Watch out for the next sequel...

Fishbone diagram

The fishbone diagram:

The fishbone diagram is one of the easiest mind mapping / problem solving tools available.  It is so simple and straightforward that anyone with the knowledge about a certain topic can generate a diagram to show its cause / effect conditions.  Below is a generic representation of a fishbone diagram.


In illustrating a problem root cause analysis, a diagram as above can be generated.  During its generation, ideas must be poured out without much thought or evaluation yet.  Start from the effect (PROB) which is the "head" of the fishbone, and then proceed to ask why-why questions so as to generate ideas for possible root causes.  A probable cause must be evaluated for further probable causes.  So based on the above, there are four major possible root causes, A, B, C, and D.  Each of them have their own possible root causes as well.  the yellow color boxes are examples of root causes as they are the ones without further identifiable causes (thus, root).  Each root cause can appear in one or more instance.

After generating the fishbone, an evaluation of the probable root causes must be designed by experimentation so as to rule out the non-contributing causes.  A simple table is normally generated to summarize the results.  An example is shown below:

 

With this exercise therefore, we are able to determine that the root cause of the problem is "M" and therefore, correcting this root cause will solve our problem under study.

For better results, a team approach to this discipline is a good option.  More minds can lead to a wider fishbone and thus can capture more possible root causes.  As the saying goes, "more heads are better than one."