Wednesday, August 31, 2011

Holy moley - look at these PCBs

Well just as we'd got some piezos into our little drum kits, there was a ding-dong on the door of Nerd Towers, and a DHL parcel arrived. It was the double-sided PCBs from PCBCart! Like spoilt kids at Christmas, we immediately forgot about what we were doing and ripped apart the latest present to arrive. Impressive looking stuff...

Black solder mask, hot-air-solder-levelled (HASL) contacts and lovely white silkscreen on the front:

Here's one in place on an actual miniature guitar:

We've got some tiny quarter-pitch cable soldered onto one of the PCBs already - now we just need to mount a miniature USB socket onto a board so we can try the actual device out and make sure everything works as it should!

Miniature drums again

Just when it looked like we were all set to finally complete a miniature synth, our piezos arrived in the post - so naturally we dropped everything and set to work on our miniature drum kit again!

Here it is, looking more and more like a real drumkit every day...


At first, we made little acrylic circles for the tops and bottoms of each drum (see where the base of the snare drum meets the stand, for example) and covered these in shiny chrome sticker paper. Then we found some 3.5mm chrome door strip (for pimping up your car) on eBay and decided that gave a much nicer finish (see tom toms and floor drum for example).

The chrome sticker came in handy for finishing off the hi-hat, so it didn't go to waste!
Hopefully we'll get a final drumkit prototype working some time tonight....

Monday, August 29, 2011

Minature instruments again - synth redesign

Some more electronics goodies arrived in the post this weekend, so while the idea of making an X-Y CNC type framework is still very exciting, it's time to turn back to our miniature instruments idea. In in particular, we've been looking at our miniature synth.

Although we got a working keyboard up and running relatively quickly, when it comes to boxing it all up and putting it inside a nice neat enclosure, things have taken a turn for the worse. Using the existing key layout as a guide, we put together some designs for three different types of synth:
  • Mini-moog
  • Roland style keyboard
  • Yamaha keytar




The problem is, the actual keys part of a synthesizer keyboard are only a small part of the overall instrument. So while the keys look fine on their own, put them, inside an enclosure, and the whole thing looks enormous - especially when compared to the guitar and drums

Cutting out prototypes from cardboard is a much cheaper way to try out new ideas, without spending a fortune on laser cutting acrylic which could very well turn out to be useless!

So we've had to re-scale the keyboard part of our synth.
At first, we just scaled the plastic keys to about 80%, printed them out and tried to see how they'd fit in with the rest of the range. Of course, this didn't work - because the PCB will pretty much decide how big (or small) our keyboard can be. We've redesigned the PCB so that the pushbuttons for the keys are as close together as possible, and then used that as the basis for the new keys layout.

All in all, the final synth design is about 75% smaller than the first attempt.
But more importantly, it's a little more in-keeping with the rest of the instruments in the range.


Thursday, August 25, 2011

Toshiba Smarbo, the new roomba

Toshiba Smarbo
 We've all seen the iRobot, LG, and Samsung robots, but there's a new bot on the market. Smarbo is the latest in robot vacuum technology and its developers are Toshiba. This robot has some very cool innards such as 38 sensors for a better job well done, and CPU(s) that aid with the "double brain function." However that's not all, Toshiba claims that this little pie shaped robot can clean over 1,000 square feet in about 90 minutes. Toshiba also plans to release this bot on October first, and its price tag isn't too thrifty, being at a big $1,000. Well, thanks for reading and we will add a video of this amazing bot when the video first comes out.


Wednesday, August 24, 2011

Lexmark X73 all-in-one printer scanner

I got one of these off eBay today.
I'd been scouring Freecycle for a while and any time a scanner or a printer came up, put in a reply begging for it - sometimes even explaining that it was going to be fully recycled into something more interesting and infinitely more useful (although perhaps that's why no-one ever got back to me) - but nothing came up.
So I put a bid on this Lexmark X73 and won it. For an amazing 50p!



It was a bit cumbersome, travelling across Brighton & Hove with it (and a sort-of-working monitor I also got for 50p but that's for another post) under one arm, mounting and dismounting a variety of buses, but worth it in the end.

It took less than 45 minutes to reduce an all-in-one printer/scanner to this pile of recyling/rubbish...



...and this pile of rather useful looking parts:



Here's what I managed to salvage -
a) 0.1" and 0.05" pitch ribbon connectors
b) two-wire motor
c) rods and rails
d) cogs/gears/pulleys
e) four wire stepper motor
f) 5mm pitch belt
g) 2.5mm pitch belt
h) six wire stepper motor
i) my dismantling tools (not included!)

And of course, a fairly beefy power supply - 30VDC 1A output
Given that this power supply came with the printer/scanner, we can safely assume it's good enough to power all motors together - there's only one way to know for sure, but it's getting late (it took nearly three hours to get across the city and back again on the buses this evening, so I didn't get started 'til 10pm) so it'll have to wait 'til the morning now.....

Tuesday, August 23, 2011

Stepper motor forwards and reverse



A quick video showing the stepper motor going in both forwards and reverse directions.

Schematic shows PORTD connected to two ULN2803A darlington array ICs. For simplicity we've used one IC per motor, but each IC can in theory support two motors at a time - the 16-pin ULN2003A has only 7 available darlingtons, these 18-pin ULN2803A chips have eight). Pin selection is a bit messy - we'll probably move these around for the final version when it comes to putting everything down on a PCB, for easier routing.

The jog buttons (RB7 + RB6) allow the user to manually move the stepper motor in either direction. Alternatively, you can send a move "request" to the microcontroller, which consists of number of steps to move (a two-byte value) and direction (forwards/reverse)


The noise in the video is not rowing neighbours, as suggested by some viewers, but a Radio4 play and my partner on a sewing machine in the other room!


In the video we're using a 1.8 degree stepper motor.
That means 360/1.8 = 200 steps for one complete rotation. We're driving the motor in "half-step" mode (for increased precision when connected to a belt-drive) so 400 steps are required for a full rotation. The video shows a value of 1 (high byte) and 144 (low byte) being entered - this is the same as (1*256)+144 = 400

The motor responds by completing one full complete rotation.

Monday, August 22, 2011

Driving a stepper motor directly from a PIC

Much has been written about driving stepper motors. Some sites say it's easy. Some people say it's hard. Some people say you have to get the timing and the sequence right, some people say it's more hassle than it's worth and you should just buy a stepper driver board!

We've spent just a few hours today playing about with our (quite beefy) stepper motor (borrowed from Matt at 18robots.com until we can buy/salvage some 1.8 degree steppers) and found it's quite straight forward - provided you follow each step slowly and carefully.

The first thing to do is understand how the stepper motor works.



We're just going to stick to the common 4-phase stepper motor. It has four coils and we need to energise each coil in a particular sequence, in order to get the shaft to turn.

For the sake of simplicity, we'll only use one form of stepping (you can use whole-step, half-step and micro-stepping for different levels of precision). For whole stepping, you energise one coil at a time. With micro-stepping, you vary the amount of current going into one or two coils at a time. We're going to make all our movements using half-stepping, which means activating one or two coils at any one time.

To get the above stepper to move anti-clockwise, we need to energise:
  • coil 1 only
  • coils 1+2
  • coil 2 only
  • coils 2+3
  • coil 3 only
  • coils 3+4
  • coil 4 only
  • coils 4+1

As you can see, it takes 8 pulse combinations then we're back at the start. This sort of makes sense, since we have four coils, and we're using half-stepping (twice as many steps needed as for whole-stepping).

Now we know how a stepper motor works, we need to identify each wire in our bunch of six coloured wires. Sadly, there's no common colour chart to refer to - different manufacturers use different coloured wires so don't just blindly follow this set-up: find out how your own stepper is wired using this technique



Create a chart listing all six colours of your stepper motor in rows and columns.
With a multi-meter, measure the resistance between each coloured wire and the five other wires. Write down these values - each coloured wire should be connected to two other wires. It doesn't matter what these values are, what we're looking for is which values are twice the others.



Where you have the double-resistance values (in our case, black + green and red + blue) this is where you've just measured across two coils. These are the outer-most coil wires (in our example, black=A, green=C, red=D, blue=F)

Where you have single resistance values (in our case black + yellow, green + yellow and red + white, blue + white) you've just measured across a single coil so one of these pairs of wires must be the "one in the middle" - or common wire.
In our example, yellow is between black and green, so yellow=B and white=E

With this information, we're ready to wire everything up and make our motors move!



We've created a USB interface which allows us to send movement commands to the PIC 18F4550 microcontroller as well as a "jog" button. We can send a command to the PIC to say "move the motor through X number of steps", or we can "jog" the motor - i.e. make it rotate for as long as the button is pressed.

Here's a snippet of the Oshonsoft Basic code for controlling the single stepper motor:


loop:

     UsbService
     
     'every time we take an input pin high, pulse the stepper
     If PORTB.7 = 0 Then
           'jog the x axis motor
           jog_x = 1
           steps_to_move_x = 0
           Gosub stepmotor
           Gosub delay_after_pulse
     Else
     
           'update the X axis motor
           If steps_to_move_x > 0 Then
                 Gosub stepmotor
                 steps_to_move_x = steps_to_move_x - 1
                 Gosub delay_after_pulse
           Endif
     Endif
     
Goto loop
End



stepmotor:
     If stepdir = 0 Then
           step_pos = step_pos + 1
           If step_pos > 7 Then step_pos = 0
     Else
           If step_pos = 0 Then
                 step_pos = 7
           Else
                 step_pos = step_pos - 1
           Endif
     Endif
     
     Gosub energizecoil
Return



energizecoil:

     'our test stepper is wired with
     'red-white-blue and green-yellow-black connected
     '(white is common, yellow is common) so we need to drive them
     'in the pattern red, black, blue, green
     'to turn in one direction and red, green, blue, black to
     'turn in the opposite direction

     Select Case step_pos
                 
           Case 0
           Low x_coil4pin
           High x_coil1pin

           Case 1
           High x_coil1pin
           High x_coil2pin
                             
           Case 2
           Low x_coil1pin
           High x_coil2pin
                       
           Case 3
           High x_coil2pin
           High x_coil3pin
                 
           Case 4
           Low x_coil2pin
           High x_coil3pin

           Case 5
           High x_coil3pin
           High x_coil4pin
                                   
           Case 6
           Low x_coil3pin
           High x_coil4pin
                       
           Case 7
           High x_coil4pin
           High x_coil1pin
                             
     EndSelect

Return



delay_after_pulse:
     If stepper_delay_us > 0 Then
           WaitUs stepper_delay_us
     Else
           WaitMs stepper_delay_ms
     Endif
Return



We've split the current position of the motor into 8 segments (numbered 0-7) so we always know which is the next combination of coils to energise to continue rotation. So wherever the motor stops, it can start again from exactly the same position - we don't have to return to a "known rest-state" as we should always know the next step in the sequence.

To move the motor, we can either hold down the jog button, or set a value in the two-byte variable called steps_to_move_x (this motor will form the basis of our x-axis). If this variable contains a value, we energise the necessary coils, move onto the next coil "state" and reduce the value in steps_to_move_x by one.
When this value reaches zero, we can send a message back to the PC to say we've arrived at our destination. This way, the PC can use a "fire-and-forget" messaging system: it tells the device how far it wants each motor on each axis to move, then gets on with other work. It doesn't have to keep asking for an update report, the device will inform the PC when the task has been performed (the PC fires off the request, then can forget about it!)



Here's a quick video demonstrating single-axis rotation using a 4-phase stepper motor. You can press (and hold) a button to "jog" the motor along, or send a value to the microcontroller, to tell it to move through a specific number of steps.


Sorry about the bad light! This was taken in the early hours of the morning (when most of the coolest development gets done) and it seems the camera doesn't like our artificial light)

Moving in the X and Y axis

Using a ULN2003A darlington array (sometimes called a relay driver when used for switching things on and off) we're working on building our own stepper motor control board.

This isn't quite as crazy as it sounds and there are a few reasons for doing this.
First off, we're making a pick-and-place type machine, so drawing complicated shapes and arcs isn't important. It's not going to be g-code compatible (at least to begin with) so we can use our own protocols and data formats. And it'll be PIC-based, so we can use the USB interface, rather than the usual parallel port.

All we're going to worry about for now is moving in two axes (eventually we'll have three when we introduce the up/down head movement). Traditional CNC machines time their stepper movement, so that when a co-ordinate is sent, both motors are powered to arrive at the correct X and Y co-ordinates the same time.



Our plan is to send values to the controller board, indicating how far in each axis we want the motors to move. The controller board translates these into "steps required per axis" and then sets counter values.

For example, if we're using half-step control, with 1.8 degree motors so that 400 pulses are required for a single rotation, one pulse should create a 0.25mm movement (see previous post for explanation)

We can send data to the control board, saying we want to move 10mm in the X and 25mm in the Y axis. This translates as 40 pulses on the X motor, 100 pulses on the Y motor. So we set the x counter to 40 and Y counter to 100.
Now, on the controller board, we send a pulse to every motor that has a counter value greater than zero, and decrease those counters by one. When all counters have a value zero, we send a report back to the host PC to say we've arrived at our destination.

The resulting movement would be similar to the diagram below:



What now? More CNC goodness!

The whole miniature instruments project grinds to a halt, while we wait for the postie to bring us a whole load of goodies to finish them off.
The drums need piezos for the underside of the drumheads (to send a strike signal back to the microcontroller when each drum is hit), the guitars are awaiting double-sided PCBs for the guitar neck, and the synth needs a miniature rotary pot and some LEDs.

So while we're waiting for all these bits and bobs to arrive from a variety of sources (mainly Farnell and eBay) we're starting to think about production. While it's easy enough to get things made cheaply overseas, we're a bit nervous about committing thousands of pounds to get hundreds of miniature instruments made. That's money that would be better spent on tools and equipment for other projects! Also, by committing to having loads of the same thing made, the options for customising them is greatly reduced. By manufacturing the little instruments ourselves, we can offer a full customisation service - and keep initial costs down (even if it means the cost to manufacture each one increases).

What we'd love to have/make is a pick-n-place machine for putting all those fiddly little SMT components in place on the PCB. If the same machine could also drop blobs of solder paste in the right place too, all the better.

We've already had a play with CNC machinery and on the face of it, creating and controlling a CNC machine shouldn't be too great a problem. Unlike a CNC router, we don't have to move large, heavy, cutting heads, or worry too much about external/twisting stresses on the machine joints.

Thanks to the guys at Oomlout, we've got pretty much all we need as far as servos and control gear goes. Stepper motors can be salvaged from old printers and scanners (we will be re-subscribing to the Freecycle mailing list to see what comes up!). We're considering a belt-drive rather than a threaded-rod for driving each axis. Lead-screws are great for low-speed, high-precision work, where high torque and large stresses and strains are used. Belt-driven control means faster rates of movement.

Although this is still in the early stages, here's what we've come up with:
Firstly, we're going to use stepper motors for controlling each axis. This is a no-brainer! BUT - CNC software (Mach3, MasterCAM, RouteOut etc) is notoriously difficult to get started with. So while using a Mach3-compatible control board (there are loads on eBay) means we can have something up and running very quickly, the finished product is then dependent on Mach3 (or similar software) which needs lots of parameters setting to configure correctly. Great if you're into that sort of thing, buy we'd just like to make a device you can plug in and drive!
The other issue with most CNC homebrew software is that it requires a "real" parallel port. Something our little laptops don't have! And we'd like everyone at nerd club to be able to use the machine, without having to have a dedicated CNC controller PC.

All this means that we're looking at creating our own (PIC-based, USB driven) stepper motor control board, as well as our own custom controller software. Because we don't want to draw fancy shapes, circles and arcs - we just want to control an x and y axis - we're pretty confident that our own custom drivers should be feasible. For this project, ease of use (and ease of understanding) is key to everything!

We're already familiar with the ULN2003A darlington array chips, so we'll use those to actually drive each stepper motor.


Now a belt-driven approach is a pretty new concept at Nerd Towers, so we're deliberately choosing values and ratios that make things easy to understand. They may not be the most efficient, or "best" choice for a particular purpose, but because we're building the driver board and driving software ourselves, it needs to be easy to understand (and easy to debug when things go wrong - as they invariably will!)

We're using 1.8 degree stepper motors.
This means it takes 200 steps to perform a single rotation (360 / 1.8 = 200).
We're also going to be using 5mm pitch belt (because it's easy to get hold of)



So if we have 5mm pitch belt, and use a gear/cog with 20 teeth, this means that in one rotation (200 steps) we can move our belt (5x20) 100mm. Which gives our CNC type machine 200 steps to move 100mm - or 1 step moves (100/200) = 0.5mm.
This is pretty good precision. If we drive the motors in "half-step" mode, we can get this precision down to 0.25mm

Many belt-driven CNC machines (laser cutters for example) can acheive precision of 0.1mm, using micro-stepping. While that level of precison would be a nice aim, our core driving principle is "easy-to-understand" so we'll accept slightly less precision for a much simpler machine! After all, a quarter of a millimetre is pretty precise when it comes to dropping SMT components onto a PCB.



Sunday, August 21, 2011

Drumkit starting to look like a drumkit

Not had much time this weekend to do much work on the new drumkit (let alone finish off the miniature synth which, although working, still doesn't have a shell for it!) but did manage an hour or so to cut out the rest of the drum rims and a neato stand for the snare drum.

The floor tom also has legs attached and the drum body stands off the floor now, but it's the snare stand that we're particularly pleased with!



Coming up with a working crash/ride cymbal is proving quite tricky (although we've got the designs for the stand down now!) And of course, we need a nice solid way to mount the tom-toms on top of the bass drum. Most real drumkits have a central column with two pieces coming off it (a bit like a letter T)...



... whereas some have two distinctly different mounts, one for each tom:


Whichever method we use, we'll have to have some sort of hollow tubing, to stuff the wires up to keep them out of sight! So with that in mind, two separate stands might actually be easier to work with (joining two hollow tubes at right angles, while keeping the route clear for wiring sounds tricky to us!)

But already it's late - that'll have to stay as a problem for the morning.

Saturday, August 20, 2011

Miniature playable drumkit from scratch

Having already got an existing drumkit (bought from eBay) working as a miniature playable digital drum machine, we decided to have a go at making a new kit from scratch.



Examining (ok, destroying) the original kit we bought, it simply looks to be made from a few different sized bits of plastic tubing, with clear acetate for drum skins. So far, so easy. We'll be using some thin HIPS (high-impact polystyrene) in white for our skins (there's no real point trying to stick with transparent skins, since it allows the underside of the piezo, that we use to detect drum hits, to show through).



So a trip to Wickes for some plastic pipe, and a quick cutting session on the laser cutter later....







The drum "skin" sits nicely on top of the drum "body" (plastic pipe). But the join is a bit obvious. We need a way to disguise the nasty join. Car automotive chrome strips work nicely...







... until you turn the drum around to reveal the super-glued join (regular glue isn't strong enough to stop the chrome band from un-coiling from around the drum body)





So we tried a different approach - laser cutting some circles to create a 2mm "rim" around the top and bottom of each drum body. The idea being that it creates a recess for the drum skin to sit inside (hiding the nasty join between skin and body) and we can then just place a band of shiny metallic vinyl sticker around each rim to give the illusion of a metal/chrome band



The rim acrylic is 3mm thick, which allows 1.5mm on the body, and 1.5mm to stand proud. The skin HIPS is 1mm thick, so after fitting, the rim should stand slightly proud of the skin



Note how after placing the rim acrylic on the body, a slight recess is created, to accept the (white) drum skin and hide any nasty joins.



We left the backing on some of the rims, just so they would be easier to identify in these photos!







The "plastic circles" approach seems to work quite well, but until we get some chrome banding on, we won't know for sure whether it's a viable option. But it's certainly quick and easy enough to do!







This is the basis for our hi-hat stand.

We've used some off-cut disks from the centre of the rim circles to prove the concept, but for the final design, we're hoping to use something that looks a little more like a real pair of hi-hat cymbals.



As before, the backing has been left on the black acrylic, just to make it easier to see the component parts



The stand is made from two "planes" which create a 3D shape using the traditional "slotted cross" arrangement.







The two "cymbals" need to be separated by some rubber, or perhaps some anti-static packing foam or similar, allowing them to be struck together, just like a real hi-hat would. In the photo below, you can see that there is a gap between the top disk (representing the top cymbal in this example) and the top of the plastic arms used to hold it in place. This gap would be taken up with the introduction of some little rubber stand-offs between the two "cymbals".







This is the layout for the drum rims from a sheet of acrylic.

We tried to reduce the total amount of waste. Cutting out circles with hollow centres is always going to create waste, so where possible we tried to fit one rim inside another. The grey areas below show the parts of the acrylic that will probably end up being wasted - so it's not quite as bad as it could have been!









Friday, August 19, 2011

Revised Sun Tracker Sensor

In the last version of sun tracker sensor, The cross was erroneously mounted with 45 degree offset with LEDs. Also the diameter of the cross was almost equal to the diameter of LEDs, which is not correct as the shadow of the cross will not cover the complete LED.For highest resolution, i can keep both the Cross and the pipe at the same height as i have done in my old version of sensor, but in this case the motors won't halt at any time and oscillate between forward and backward.
So to avoid frequent forward and backward motion and to conserve electricity to drive the motors i set a rule of thumbs "The Height of the cross should be 30% more than the height of the pipe" and "The diameter of the cross should be more than twice the diameter of LED".
This will be cater for in this revised version.

Updates on Sun Tracker Sensor

Here is the updates on the Sun Tracker sensor.. The sensor testing is still in Progress...After testing of this sensor, A better revised circuit version will come out later..




My first mistake, The cross is offset by 45 degree.. It should be aligned with the Sensor LED's..


Understanding synth playback values





A few people have asked how do we read back the values from the key presses on the synth. It's a relatively simple bit-masking process, but at first appears complicated.



The first thing to do is refer to the map of keypress values (above).

Because our inputs are active low as well as recording the value generated when each button is pressed, we've also written down the inverse of this value.



Say, for example, we press the first button on the PCB.

This returns the value 191.

We take the inverse of the value. Strictly speaking, what this means is we convert the value to binary, which gives us 10111111.

The inverse of this is 01000000.

You can get the same result by subtracting the initial value from 255.

So in this case, 255-191=64 (which is 01000000 in binary)



Because each key on the synth activates a unique bit in the binary sequence, any number of keys can be pressed at any one time.

If we press the low C key (first key to the left) and the Eb key (fourth from the left, including "black notes") the PC returns the value 189.



Converting 189 to binary and inverting (or subtracting from 255) and we get 66, which is represented by 01000010



As you can see from the previous example, both binary sequences begin 01.... so whenever the second bit in the binary sequence is one, we know that the low C key has been pressed.



By identifying the values for all the keys, we can plot which bit in each binary sequence represents which key-press on the keyboard. In our PC app, we'll monitor the last known value of these binary sequences to the current one and this will allow us to work out which key has just been pressed (and equally, which key or keys have just been released). With this information, we can trigger and stop sounds playing, to recreate a genuine playable synth.



See - it's nearly working already ;-)



Why the need for plotting all the values? It has been suggested that we should make the first pushbutton go to PORTB.0 (bit 0), the second button go to B.1 (bit 1) and so on, to simplify reading the data back. In fact, this is exactly what we did in the prototype. The beauty of breadboard prototypes is that you can have wires leading everywhere, looping over each other, winding in and out of other wires.

When you come to create a PCB, however, layout is critical. So our push buttons are actually laid out 17,16,1,2,7,8 and so on. While this doesn't make sense to the casuall observer, it's much easier to use a rigid layout pattern, and make allowances for it in firmware/code, than it is to stick rigidly to a set firmware/pinout and try to force your PCB layout to match it!




[edit - 10pm same day]

Here's a short video showing the custom software (note how it detects when the instrument has been plugged in and changes the interface - we really like that subtle little touch!) and a working demonstration of the synth







I need to remember to close the windows when shooting demo videos like this! And maybe turn the telly down a bit too. And, of course, make sure the volume is up on the PC before starting!



You can see on the video that the synth not only supports "key down" type events - i.e. triggers a sample when a key is pressed - but also raises "key up" events too - stopping a sound when you lift your finger off a key, just like a real synth! Chords are played to demonstrate that the miniature synth is truly polyphonic: multiple keys can play at once. I dread to think what it would sound like, but in theory you can press (and the PC will respond to) all 17 keys at the same time. Better than some early casio keyboards even!



Thursday, August 18, 2011

Videos on bots #5

This week's videos on bots features some very interesting robots that I hope you will enjoy as much as I did.

 
This video shows two lego nxt sumo robots battling in a sumo competition.

 In this video it shows a very cool BEAM robot that can walk, no wonder its called the "walkman."

 This videos shows you how to make a fully functional "beetlebot" in under twenty minutes!

 If you thought Nissan only made cars then think again, check out their "Eporo" robots.

This videos shows a unique alarm clock robot that rolls when the alarm goes off, causing you to get up, chase it, and then turn it off.

So thanks for reading and I will be getting back to posting everyday very soon.











Meet swarmanoids, the newest in swarm robotics

Well, when I was on youtube I saw this video and I was amazed! I'm not going to describe it because when you watch the video you'll understand, just take a look. I promise you, that you won't regret it!

Working miniature synth (nearly)

Despite looking like a complicated instrument, the synth was actually one of the easiest to manufacture and to code the firmware for. In fact, it only took a few hours this afternoon to get a "working" miniature synthesizer!

As ever, the first thing to do was create a PCB with a working PIC microcontroller for the USB/HID interface







The acrylic keys sit over a large, single-piece, PCB.

There are 17 pushbuttons, arranged so that each one sits under the front-most edge of each individual key.







These pushbuttons are routed to the digital input pins on our old friend the 18F2455 PIC microcontroller.



After all our fancy routing and re-naming buttons, pins and ports, we forgot to connect the ground pin of the USB socket to the ground trace on the board! D'oh.



Since we discovered hot air soldering, and how surface mount components can be just as quick and easy as (and sometimes quicker and easier than) through hole components (no pesky drilling) we've decided to stick with the surface mount version of this chip, rather than the earlier favoured through-hole version.



That's all there is to this synth really - we've allowed for a rotary dial/potentiometer on one of the analogue pins, and perhaps a separate pushbutton to switch sustain on and off. But really, it's just a simple PCB with a load of buttons.



We decided to use the PIC's internal pull-up resistors on PORTB, which means that all input pins are high and when a button is pressed, the input goes low. Likewise, we wired the remaining buttons up the same way (high with no input, low when the button is pressed) which means that for 17 keys, we only used 9 pull-up resistors instead of needing one for each button.



The remaining 9 inputs were spread across PORTA and PORTC.

This makes reading the data back a little difficult but not impossible. We use three different byte-sized buffers, to report back the status of every button over USB. PortA is bit-masked by reading the value off the port, and OR-ing with the input pins not used (in our case, only RA1-RA5 are used, so we OR the value on PORTA with 1+64+128 = 193) This is because RA0 is the analogue input (2^0=1) and RA6(2^6=64) and RA7(2^7=128) are not used, so we will always report these bits as high (not pressed) irrspective of their state.



By doing this, we should get a unique combination of numbers on the three buffer bytes, for every combination of key presses. This allows up to 17 keys to be pressed and recognised - a truly polyphonic synthesizer!



To find out which buttons returned which values, we knocked up a simple VB app which reads the first three bytes back from the USB device and displays them on screen.







This photo shows how pressing the first "key" on the keyboard results in byte3 taking the value 191. We went through every single key, pressing each one in turn, and wrote down each of the three byte buffer values. This map of values will form the basis of our playback code.







Because the input pins are high when inactive and low when active (when the button is pressed) we can invert the key buffer values (subtract from 255) to work out which key (or combination of keys) is pressed. When two or more keys are pressed, their values are simply OR-ed together.



For example, if a key with the inverse value 64 is pressed together with one having an inverse value of 4, together with one having the inverse value 1 (when playing a chord or triad, for example), the keyboard input buffer value will simply be 64+4+1=69



By taking the values from each of the three byte buffers, and using simple logic queries (AND/OR) we can easily identify exactly which combination of keys has been pressed at any one time.

Updates on Dual Axes Sun Tracker with Sensor

A drawback of living in a remote location is that, among many other things, it is hard to find a big electronics component store. During my last visit to Karachi, I had purchased a good amount of electronic components from electronics market. i also collected some visiting cards from the dealers that now helping me sourcing hard-to-find electronic components for the Solar tracker and MPPT(Maximum Power Point Tracker) controller. Still one component MAX4713 is missing and they are keep trying to find for me.The modern communication means helped mutually  both the parties in getting required components.

Spent about Rs.9000 purchasing misc. components that will be used in my other projects. I have now good amount of components and can easily make assembly line for manufacturing of sun-tracker, MPPT and sensor.
Here is the dual axes sun tracker with the sensor. The circuit was etched yesterday and all components were mounted. today i will calibrate the sensor and check the working of the circuit board.




Google+ Me+ Plus-Minus





Just a quick post for anyone else still having problems with the Google Plus extension Plus/Minus (sometimes called Me+) for Google Chrome. This brilliant little plug-in lets you collapse already read posts and filter your stream by members of your different circles. I'm surprised that Google hadn't already thought of it when they launched Google+

(what do you mean you don't use Google+ ???)



Anyway, it stopped working yesterday.

I just thought it was my laptop getting crabby from not being shut down properly for a week or so (I always just put it into standby and drop the lid on it between sessions) so rebooted. But still it didn't work.



It turns out that the Google bods have been busy at work, re-writing great chunks of their code, so the plug-in no longer matches the new "improved" DOM model.



Luckily, the answer is simple.

The PlusMinus plug-in creates a little icon in your URL bar.

Right-click on this and select "manage plug ins"







From the list of installed plug-ins, find the PlusMinus entry and expand the developer tab. Then just jab "update" and restart Google Chrome. All should be working again!