Bite Size Arduino – Sharp IR Sensor

I have received a few messages asking me to give a bit more detail into the individual bits of the robots I have built so far. Thus I am starting this series of posts in which I will cover a single sensor\actuator integration to an Arduino board per post.

Today we will have a look at how to use a Sharp IR Sensor.

The IR sensor has 3 pins – 2 pins used to power the sensor and a signal pin that is used to communicate its reading.

sharpIR_bb

As shown in the image above, connect the red pin to the 5V pin on the Arduino, the black to the GND pin and the yellow signal pin to any one of the analog pins, for the purpose of this example we will use A4.

Below is the code used to get a reading from the sensor and print it out using the Serial.println:

#define IR_PIN A4
int IRDist = 0; 

void setup()
{
Serial.begin(9600);
}

void loop()
{
pinMode(IR_PIN,INPUT);
IRDist = analogRead(IR_PIN);
Serial.println(IRDist);
delay(1000);
}

I suggest using this code to experiment and see what readings get generated by placing the sensor at different distances from an obstacle.

Bite Size Arduino – Sharp IR Sensor

Retro Video Game Collecting Tips

One of my vices is collecting video games, mostly retro, but current generation as well. My collection spans close to a thousand items, and ranges from the 8 bit era (NES and Master System) to the current generation (PS4 and WiiU). My collection is mostly focused on Nintendo, but I have branched out into collecting Sega, Sony and Microsoft as well.

So today I will share some things that I have learned over time collecting video games.

1. Know what to collect. By this I mean that depending on your region (PAL or NTSC) some systems might be easier to collect than others. For example, generally in PAL regions Sega had a much bigger footprint in the 8 bit and 16 bit eras than Nintendo, so finding Sega games and systems are a lot easier and less expensive, whereas in the NTSC regions this applies to Nintendo in general. This does not mean you should not, for example, collect Super Nintendo in a PAL region, it just means that if you do you should realise you will probably struggle to find items and will also pay a premium price for them when you do.

2. Know where to look for items. So if you decide to collect for a retro system, you can’t exactly go to a normal video game shop and pick up items for the system, you will need to look at places that have second-hand goods. Thrift stores, pawn brokers, second-hand and charity shops are all good places to check, and check these places on a regular basis, things come and go quickly especially if there are other collectors around. Online shops, such as eBay, are also an option, however this can get very expensive as prices are quite often seriously inflated on online auction sites, so if you decide to go this route check prices very carefully as you might end up paying way more than an item is worth.

3. Check item condition. This is most relevant for disc-based games, as they scratch and damage relatively easily. Cartridge-based games tend to be a lot more resilient, however it is still essential to check for label damage as this can greatly affect the value of a game. In general you also do not want to buy video game systems that are not working, except if they are really cheap, in which case it might be worth taking a chance and attempting to fix the system or using it for spare parts. This leads us straight into our next point.

4. If you are scared of a little bit of soldering and basic electronics then collecting any old electronic items (like video game systems) might not be a great idea. Sometimes you will have to get your hands dirty when trying to get a 20-year-old system up and running.

5. Have a short list of items to look out for. Have a general idea of what the very rare or expensive games for the systems you are collecting for are. I have on a few occasions picked up rare games with list prices of over $100(USD) for not even 5 percent of that cost, because I knew what to look out for.

6. Catalog your collection. When your collection is small it is easy to remember what you have, but as your collection grows, tracking what you have becomes a lot more difficult. So doing this from the start makes your life a great deal easier in the long run. Anything from a spreadsheet to specialised software can be used for this. Besides providing a quantitative view of your collection, this will also help to prevent unintentional buying of duplicate items.

7. Don’t be scared to pick up good items for trade. On numerous occasions I have run into rare items I already had in my collection at very low prices. I pick these items up and use them to trade for items I don’t have. This can be done directly with other collectors or with dealers where games can often be traded in for credit. By doing this correctly you can quickly double or triple you investment in trade credit.

8. Enjoy the hunt. If you don’t enjoy going out and looking for items, this is probably not a hobby you will enjoy. A huge part of the fun is looking for and finding rare and expensive items at a fraction of their value.

I hope this post gave a bit of insight into the addictive hobby of collecting video games.

Lastly I have a PS3 Minecraft download code to give away! All you need to do to stand a chance to win it is to leave a comment to this article. The best comment will receive the download code, so be creative. The winner will be announced on 1 September 2015.

Retro Video Game Collecting Tips

The Geek So Far – A Work In Progress

This post is a quick update on the Geek robot build so far. A fair amount of trial and error and a bit of experimentation has consumed a lot of my time in the construction thus far. I believe this build will still take a long time because of the vast amount of tasks that still needs to be completed.

robot

So here is a quick view of the robot so far.

The robot has a total of 14 servos that are allocated as follows:

  • Two micro servos (1.3kg per cm) in the neck in a mini pan tilt plastic mounting.
  • Two servos (one metal gear 20kg per cm and one 18kg per cm) in the robot waist in a pan tilt metal mounting.
  • Each arm has three servos (a 18kg per cm servo in the shoulder and two 1.3kg per cm micro servos for the rest of the arm movement).
  • Each leg consists of two servos (18kg per cm).

arm lower body  foot

The robots’ head contains two cameras, an Arduino 2 mega pixel camera for static images and a Logitech web cam for video (I removed the web cam housing as it
was too bulky).

The robots’ feet are aluminium housings that will contain the batteries that will power the robot. This is to keep the weight at the bottom of the robot, thus helping to balance it. I am still investigating the exact battery configuration to use as I would prefer a rechargeable option.

I used a fair amount of Timiya universal metal joints during the assembly so far and these are very handy in building any robot.

The robot currently has two ultrasonic sensors and one infrared distance sensor. The ultrasonic sensors are mounted on the front of the feet for obstacle detection and the infrared distance sensor is mounted on the front of the robots’ hips and will be used to detect vertical drops.

I plan to mount another ultrasonic sensor and infrared distance sensor on the robots’ back, to allow for the robot to avoid obstacles when it moves backwards.

The robot has a laser diode attached to its one arm, which I intend to use for pointing as well as a point of reference for the webcam.

The next task I will be undertaking will be to start wiring the robot to the Arduino Mega R3 and Raspberry Pi 2 that I intend to use to control the robot. I will post more blog updates as progress on this robot advances.

The Geek So Far – A Work In Progress

FODA Mini Quadcopter

Numerous mini quadcopters are currently available so I decided to give one a try. As far as I could tell the feature set of all the mini quadcopters are very similar as are their prices.
I decided on the FODA Mini Quadcopter, for no particular reason other than it being very widely available. The FODA mini quadcopter is available in four colours – blue, yellow, green and white.

Box

The box contains the tiny quadcopter, the remote control, an extra set of blades, a protection cover to protect the blades during flight, a charging cable and an instruction manual.

The quadcopter is tiny, measuring in at a length and width of just under 5cm and a height of just under 2cm.

Controlling the quadcopter is quite difficult as the controls (especially the blade speed control) is extremely sensitive. Additionally these mini quadcopters do not have the built-in auto stabilisation functionality as with larger quadcopters, so learning to fly it takes a fair amount of practise and the quadcopter is very sensitive to any air movement.
After spending about 30 minutes playing with the tiny quadcopter I finally got the hang of it and I can say the quadcopter is quite resilient as I crashed it a few times and it took no damage.

quad

A close inspection of the quadcopter shows how truly amazing the little device really is, from the tiny motors to the fact that it contains a rechargeable battery is truly unbelievable.

Untitled

I would recommend the FODA mini quadcopter for anyone interested in quadcopters who do not want to spend a great deal of money. These mini quadcopters are in no way a real reflection of the larger, and much more expensive quadcopters, but they do provide a basic and inexpensive sneak peek at the mechanisms and controls of these type of devices.

I found learning to fly the mini quadcopter challenging and fun, and for the price I recommend giving one a try.

FODA Mini Quadcopter

Bite Size C# – DataTable to RecordSet Converter

When working on legacy systems you may sometimes find that a wide variety of technologies have been used, and short of rewriting a huge amount of code the only thing that can be done is to create some functionality to map between the different technologies utilised.

I had a scenario where I had to integrate 2 legacy applications utilising different technologies for database access, one utilised ADODB and the other ADO.NET. Due to time constraints I could not change the underlying code of the systems and rather decided to create a helper class to map an ADO.NET DataTable to an ADODB RecordSet in order to facilitate the integration.

My DTtoRSconvert is a static class that resides in the Core.Data.Help namespace. It contains a static method ConvertToRecordSet that takes a DataTable as a parameter and returns a RecordSet. It also has one static private method TranslateType which is used to map between the DataTable and RecordSet Data types.

Here is the code:

using System.Data;
using System.Reflection;
using ADODB;

namespace Core.Data.Helper
{
    //Helper class that convert ADO.Net DataTables to ADODB RecordSets
    public static class DTtoRSconvert
    {
        public static Recordset ConvertToRecordSet(DataTable inTable)
        {
            var recordSet = new Recordset { CursorLocation = CursorLocationEnum.adUseClient };

            var recordSetFields = recordSet.Fields;
            var inColumns = inTable.Columns;

            foreach (DataColumn column in inColumns)
            {
                recordSetFields.Append(column.ColumnName
                                    , TranslateType(column.DataType)
                                    , column.MaxLength
                                    , column.AllowDBNull
                                          ? FieldAttributeEnum.adFldIsNullable
                                          : FieldAttributeEnum.adFldUnspecified
                                    , null);
            }

            recordSet.Open(Missing.Value
                        , Missing.Value
                        , CursorTypeEnum.adOpenStatic
                        , LockTypeEnum.adLockOptimistic, 0);

            foreach (DataRow row in inTable.Rows)
            {
                recordSet.AddNew(Missing.Value,
                              Missing.Value);

                for (var columnIndex = 0; columnIndex < inColumns.Count; columnIndex++)
                {
                    recordSetFields[columnIndex].Value = row[columnIndex];
                }
            }

            return recordSet;
        }

        private static DataTypeEnum TranslateType(IReflect columnDataType)
        {
            switch (columnDataType.UnderlyingSystemType.ToString())
            {
                case "System.Boolean":
                    return DataTypeEnum.adBoolean;

                case "System.Byte":
                    return DataTypeEnum.adUnsignedTinyInt;

                case "System.Char":
                    return DataTypeEnum.adChar;

                case "System.DateTime":
                    return DataTypeEnum.adDate;

                case "System.Decimal":
                    return DataTypeEnum.adCurrency;

                case "System.Double":
                    return DataTypeEnum.adDouble;

                case "System.Int16":
                    return DataTypeEnum.adSmallInt;

                case "System.Int32":
                    return DataTypeEnum.adInteger;

                case "System.Int64":
                    return DataTypeEnum.adBigInt;

                case "System.SByte":
                    return DataTypeEnum.adTinyInt;

                case "System.Single":
                    return DataTypeEnum.adSingle;

                case "System.UInt16":
                    return DataTypeEnum.adUnsignedSmallInt;

                case "System.UInt32":
                    return DataTypeEnum.adUnsignedInt;

                case "System.UInt64":
                    return DataTypeEnum.adUnsignedBigInt;

                //System.String will also be handled by default
                default: 
                    return DataTypeEnum.adVarChar;
            }
        }
    }
}
Bite Size C# – DataTable to RecordSet Converter

LOZ Diamond Blocks

LOZ Diamond Blocks are a Chinese-made Lego clone with two unique selling points, firstly the blocks are much smaller than the traditional Lego blocks (they are in line with the size of the Japanese-made Nano blocks) and secondly they have models of famous (and probably copyrighted) characters.

boxes

Each set comes in a nice box, with the blocks and instructions in a sealed plastic bag inside so that no part can go missing. 

mario content batman content

Additionally each set comes with quite a few extra blocks, just in case you mislay one of the small pieces.

The blocks fit together easily and the instructions are straightforward to follow, however bigger fingers can sometimes be an issue as a result of some of the blocks being so tiny.

The completed models are sturdy and display very nicely.mario2 batman2

As these sets are relatively inexpensive and a variety of characters are available (from video games, super heroes, cartoons and movies) they are a cool and cost-effective way of decorating your desk.

LOZ Diamond Blocks