555 LED Flasher custom made pcb circuit

My 555 LED Flasher custom made pcb circuit finally arrived. Yay!

Previously I had designed this circuit and pcb layout as a test run (see previous post) and sent it off to OSHPark for manufacturing. It turned up in the post for last night.

It took about 3 weeks from time to placing the order to me receiving it, which seems quite reasonable for a part time hack like me. I don’t need high turn around times.

555 LED Flasher
555 LED Flasher

The PCB board looks really nice and well made. I could never get this much detail or compactness if I attempted to create a PCB on my own at home (hate playing with nasty chemicals!) But the proof will be when I solder in the components.

If I get some time this weekend I might have a go at transferring the components from the breadboard and soldering them onto the PCB. Once this is done then my workflow from design to finished product will be complete.

Sadly, the board wasn’t successful as I had hoped: Follow up post

My First Printed Circuit Board

Update: My first printed circuit board doesn’t work – to see how it all when wrong look here.

My first printed circuit board has just been designed. I’ve been creating a couple of circuits now on a breadboard, but each time I wanted to try something else I would either have to dismantle the circuit to reuse the breadboard, or buy another breadboard (I have 3 now).

Sure I can always put the circuit on a protoboard or stripboard, but I find they tend to get a little messy and they aren’t as neat.

To try out this workflow I thought I’d do something really simple to start with.

I will be sending off the design to be manufactured rather than etch my own board. It gives it a professional look and you don’t have to deal with usage and storage of corrosive  chemicals.

Here are the steps I used to create my printed circuit board. Hopefully it can be helpful for someone else wanted to give it a try.

Creating the schematic

555 flasher circuit schematic
555 flasher ‘railway crossing’ circuit

I created my schematic using the EagleCAD software. The ‘light’ version is free for hobby use and it works on my mac. 🙂

The circuit is just a simple 555 timer that flashes 2 LEDs. I think the secret to learning and testing a new workflow is to keep things simple. Remember that this is my ‘helloworld‘ of a printed circuit board. Don’t judge me 🙂

Breadboard the circuit

555 flasher circuit breadboardIt is important to test out your circuit by building it on a breadboard first. This allows you to swap out components and change your circuit around much easier. It also saves you time and more importantly money as it costs money to manufacture a printed circuit board externally and you want to make sure there are no mistakes.

Design the Printed Circuit Board

printed circuit boardI designed my PCB Layout using EagleCAD. This is my first ever printed circuit board design, so there are probably some things wrong with it. I’ve got a ground plane for the bottom later, and a power plane for the top layer. I managed to route all the nets on a single top layer. If anyone is interested then I’ll post up my source files.

Upload to a PCB Manufacturer

I took the final board file and uploaded to a PCB Manufacturer. I’m using OSHPark.com as I can simply upload the Eagle brd file without messing with Gerber files that most other manufacturers use. Perhaps in the future I’ll pick a different Manufacturer (suggestions anyone?).

OSHPark.com also seems to be reasonably priced given the size of the board I created (1″ squared = $5USD for a 2 layer design), and you get 3 boards for your trouble (some places want a minimum of 100 boards – who wants 100 x 555 flasher circuits?)

Now we wait…

Now that the board has been uploaded and approved I now need to wait until it gets manufactured, and delivered to me. From the website I’m estimating about 2 weeks. When it shows up I’ll take a few photos and comment on how awesome (or crap) it is.

While there is a bit of a wait, it saves me having to deal with the messy chemicals and cleanup if I was etching my own printed circuit board.

I’m rather excited to see how it turns out – Let the waiting begin…

 

 

Arduino Adventures.. the begining

This month I thought I would try something different and explore the Arduino that everyone is talking about.  I purchased an Arduino UNO starter kit from Australian Robotics and with a few electronic components I’ve collected over the past few years (plus a few extras that I’ve gotten recently) I’m starting my Arduino Adventures.

I had played around with electronics in the past (like when I was about 10, my uncle bought me a “Dick Smith’s Funway into Electronics”) but most of it was just following along some diagrams and plans. I never really ‘got it’ or understood what was happening. Fast forward about 30 years, and after reading about electronics again and hearing about the Arduino I thought I’d give it another shot.

Arduino Adventures
Electronics Lab

To begin on my Arduino Adventures journey, I setup my ‘electronics lab’ next to my computer (as I obviously need my computer to program the Arduino).  Being neat and organised is vital when you have lots of electronic components about. It provides you with an awesome space to do your inventing (not to mention that it is fun to sort out resistors and capacitors in their own unique draws – my OCD was off the chart!). It also makes the space a little bit more cat friendly. 🙂

I’ve been following along some of the tutorials online, however I’ve really been focusing on the Arduino Workshop book and in a short space of time have built some controlled traffic lights. Woohoo! I have found this book to be quite helpful and works well with my already understanding of basic electronics (without dumbing it down too much).

Arduino Adventures
Arduino Traffic Lights

So here is the final product.  The picture doesn’t really do it justice (next time I should upload a video). Most of the logic controlling the traffic lights is coded within the Arduino itself. You simply hook up your inputs (2 buttons, one for each set of traffic lights) and outputs (3 lights for each traffic light). It is quite an awesome feeling when it finally gets working.

I’ll most likely continue with the Arduino Workshop book for quite some time and once I’ve completed it then I should have a better idea on the kind of things I can build with this little device.  I must admit it is quite addictive.  Seeing REAL physical feedback. I haven’t had this much fun with programming for quite a while. I can’t wait until I can play with motors and stuff (which are later chapters in the book).

Also, I haven’t forgotten all my other projects (such as MonsterMovie and AdventureWorld) as I still plan on finishing those at some point. It is good to have a break from them at times so I figured having some Arduino Adventures would be a good distraction.

Dear 16 year old me

Dear 16 year old me,

As part of my quest of porting over your old Microbee computer game  ‘Adventureworld‘ that you wrote back in 1990, I’ve been studying the code and trying to work out what the 16 year old me  was thinking at the time.

I realise that that you believed that this was your first real big ‘awesome’ application, but seriously you really need to learn some standards NOW before you get yourself into real trouble.

Here are some comments of your coding standards and what you need to do to improve yourself if the 16 year old me has any hope of coding in the future. These guidelines will also make it easier for your future self (and others) to read your code 20 years later. Trust me, you really need to do this!

  • Please don’t use the variable name ‘O’ for anything. Ever! I mean seriously don’t do it! Imaging having to read this line in the future and trying to work out what it means:
    IFO=8ORO=127THEN364ELSEIFO=10ORO=24ORO=27THEN365ELSEIFO=13ORO=11THEN367

    This is especially important when you are mixing up the letter O with the number 0 . Combine that challenge with a dot matrix printout of your source code where the zeros aren’t slashed,  it will create extra headache for your future self. O, 0 look the same. Dear 16 year old me don’t do it! Don’t even get me started with the variable you used called O0. It’s just madness!

  • Please put a little more thought into your variable names. Granted that 16 year old me is just learning to code, and the basic language was rather limited, but seriously if you are going to be using x,y coordinates then maybe you should use variable names such as X and Y. Don’t use B and C (where C = X coord and B = Y coord).
  • Please put some more thought into the structure of your code. The GOTO command especially is evil, Pure evil. It does have its place though – just not here. As a example, don’t do this
    22 GOSUB23:GOTO25:GOTO99
    23 ...do stuff...
    24 RETURN
    25 ...program continues...
    ...
    99 ..do some stuff..:GOTO22
    

    You are looping all over the place.  Don’t embed your subroutines within your code, and try and bring all your code together in the one place.

I’m sure if the 16 year old me followed these guidelines it will make you a better programmer, and your future self would be able to port and understand your game a lot easier. Get started on it now! OK?

Cheers,

– Future Phil.

Note: You will be pleased to know that I have matured as a programmer since the 16 year old me started coding.

Tileset and maps

Today I have completed a little milestone and that is converting over Adventureworld’s tileset and maps into a format that can be easily read by lua.

The current map game data is in a format like this:

DATA "CMMMBBBDDDBBLLLLMMMCCCLLLMMMC..

I’ve decided to use the application Tiled to build up the tileset and maps which will make it much easier to visualise and adjust each screen. It also automatically generates some nice lua tables which will make it easier to import into the game as well.

tileset and maps
Adventureworld current tileset

The original tileset was created using  graphic characters (think of it as creating a custom font). The characters were 8×16 pixels, which looked rather small on today’s big screens. I have made a design decision to double the size of the graphics so each ’tile’ is 16×32 pixels in dimension. Having to convert decimal numbers into binary and the translating that into a pixel byte in screen brought back memories of designing sprites by hand with graph paper at school. 🙂

tilesets and maps
Current sample of a map of Adventureworld

The original game had a tilemap screen size of 64×15 characters. After adjusting the screen resolution with the new ‘doubled’ pixel size of each tile, the final game resolution ends up being 1024×480. I have currently made the game to be 1024×512 but will most likely adjust it to 1024×768 (a better ratio) later on down the track. I have attached a sample map (screen4) to give you an idea on what the game currently looks like.

Next milestone

Constructing the different game states (such as menu, help, instruction screens) and the flows between them.