Friday, August 19, 2011

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!