How difficult would this be?

chigley

Senior Member
I've been doing my research into robots for the Xbox 360 game, Guitar Hero. I've interfaced with controllers before, so hopefully wouldn't have any problems there, as I'd build this mod in a standard Xbox 360 controller rather than inside the guitar controller.

The only thing I'm not too sure about is storing the note lists somewhere, for the PICAXE to read them. A note list will be something like this image (http://www.bradleyzoo.com/GuitarHero/gh3-ps2/expert/slowride.blank.png) but in a format which the PICAXE can read and interpret.

There'll be at least 50 of these, so I'm assuming I need to store them externally. What options are available for external memory storage? Is it possible to save PICAXE programme subroutines on the external memory, or will I have to save the note lists as normal text which the PICAXE will parse? Will a normal PICAXE be fast enough to run through a notelist and output accordingly, or will an X2 part be required?

Once I can get the PICAXE reading a note list from some form external memory, I'll be able to handle the outputs based on this myself. I'm a decent programmer, but my electronics knowledge is limited. Do you think that this is too difficult based on my limited experience?

Looking forward to hearing responses! It's not easy to explain, so I hope you were able to follow!
 

hippy

Ex-Staff (retired)
It can be done but so many possibilities to choose from. I'd go for an I2C Eeprom to hold a note list and pre-process the scores on a PC before loading into I2C Eeprom but that's a multi-step effort.
 

chigley

Senior Member
It can be done but so many possibilities to choose from. I'd go for an I2C Eeprom to hold a note list and pre-process the scores on a PC before loading into I2C Eeprom but that's a multi-step effort.
Yes I figured that I'd have to pre-process the note lists myself before putting them on the EEPROM.

What formats can you save onto EEPROM with, in terms of data structure?

Thanks

EDIT: Just found the PICAXE i2c tutorial :) Having a read now.
 
Last edited:

hippy

Ex-Staff (retired)
Raw "Bytes" ( or smaller ) but those bytes can be combined and used as any data structure you want.

The data structure is probably the key here. Ideally simple and easy to understand and execute by a PICAXE but capable of supporting all that needs to be done; note value, period, tempo and beat, repeated bars, etc.

It's going to be a mix of bottom-up ( PICAXE side ) and top-down ( written score side ) design to come up with something best suitable.
 

chigley

Senior Member
Raw "Bytes" ( or smaller ) but those bytes can be combined and used as any data structure you want.

The data structure is probably the key here. Ideally simple and easy to understand and execute by a PICAXE but capable of supporting all that needs to be done; note value, period, tempo and beat, repeated bars, etc.

It's going to be a mix of bottom-up ( PICAXE side ) and top-down ( written score side ) design to come up with something best suitable.
In my head I was thinking of just using 1s and 0s for the fret states. The PICAXE reads in 5 bytes for the 5 frets - then sets the corresponding outputs high or low depending on the value read from the EEPROM. It then reads the next 5 bytes, updates outputs, and repeats until the end of the song. I'm not sure how the PICAXE would know when the song is finished though.

Strumming is another issue - as with longer notes the strum output needs to be held high for the entire length of the note. In theory, strums could be handled in the same way as the frets though, as long as the output is not switched off in between each "chunk" of 5/6 bytes.
 

womai

Senior Member
As for storage, maybe you should consider a VDrive instead of EEprom. The advantage being that you could just convert and store the files e.g. as simple text files on your computer, copy them to a USB stick that you then plug into the VDrive. So no need to connect your robot to the PC to download the files (and having to write a proprietary download routine etc.). And storage capacity would be virtually unlimited.

http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/USB031

Wolfgang
 

SilentScreamer

Senior Member
As for storage, maybe you should consider a VDrive instead of EEprom. The advantage being that you could just convert and store the files e.g. as simple text files on your computer, copy them to a USB stick that you then plug into the VDrive. So no need to connect your robot to the PC to download the files (and having to write a proprietary download routine etc.). And storage capacity would be virtually unlimited.

http://194.201.138.187/epages/Store.storefront/?ObjectPath=/Shops/Store.TechSupplies/Products/USB031

Wolfgang
Also very easy to change the USB stick so you actually do get unlimited storage.
 

BCJKiwi

Senior Member
Sorry but I just don't understand the love affair with the VDrive2.

It is serial only (never got SPI to work despite lots of posts and not yet seen an example of working code) - i2c not supported either.

uAlfat from GHI electronics has serial, spi, i2c and FAT32 support and just works - fast! and I'm sure there are other alternatives as well.
 
Last edited:

chigley

Senior Member
@boriz - Sort of. Mine won't be using mechanics to physically push the buttons though, it'll just interface directly with the controller.

@womai - Thanks for the suggestion, but that looks a bit too big to fit inside an Xbox 360 controller!
 

chigley

Senior Member
I've just been playing about with a schematic, and have come to the EEPROM. Which EEPROM chip would you recommend?

Also; when using i2c with the PICAXE, can you use any two pins for SCL and SDA? Manual 2 suggests that the slave address defines the two pins for SCL/SDA, and that the slave address depends on the EEPROM chip. Is this correct?

EDIT: To add, I don't need to worry about timing the strums for longer notes. Because I'm doing this mod in a normal Xbox 360 controller as opposed to the guitar controller, the game automatically strums for you when using a normal controller.
 
Last edited:

chigley

Senior Member
OK; I've had a little play in EAGLE, trying to come up with a schematic. This is what I've got.



A few questions...

  • All unused inputs are tied low via a 10k resistor, but I only used one resistor for all of them. Is this OK, or do I need one resistor for each pin?
  • With pins 1-3 on the EEPROM (labelled A0-A2) I wasn't sure what they were for. EAGLE seemed to think that they were inputs, so I've just tied them low via a 10k resistor. Is this OK?
  • The voltage on the transistor collectors will be between 1-2v (unable to check now.) Am I right in thinking that a resistor is required on each of the outputs to the base legs? This resistor will also presumably stop the LEDs from blowing!
  • Can you spot any other potential problems?

The transistor collectors and emitters will be interfaced with the Xbox 360 controller. The only used input (input 7, pin 16) will also be interfaced with the controller so that I can tell the PICAXE when to start "playing" the song. I also don't have the 512kb EEPROM chip in my EAGLE library, so I just used the 128kb one for the purposes of the schematic.

Feedback appreciated, as always! :)
 

BeanieBots

Moderator
Most looks OK PICAXE wise.
OK to use to use just one resistor for all unused inputs but using one for each would give more option for expansion later.
Those A0 - A2 pins on the EEPROM are to set its address.
That is so that up to eight can be connected together on the same bus.
You can set them either high or low however you desire but when you use the I2C commands, the address must match the address you set on the inputs. If in doubt, pull them all low to save any confusion later.

Your transistor/LED outputs.
Oh dear!! Totally wrong.
Read the interfacing manual. You need a resistor between PICAXE and transistor base. Emmiters connected to 0v. Collectors to LEDs via resistor to 5v.
 

chigley

Senior Member
You can set them either high or low however you desire but when you use the I2C commands, the address must match the address you set on the inputs. If in doubt, pull them all low to save any confusion later.
OK thanks. How do I know what the address for the PICAXE code is based on the three inputs? The example in the I2C manual is "%10100000" but I don't really understand where that comes from.

Your transistor/LED outputs.
Oh dear!! Totally wrong.
Read the interfacing manual. You need a resistor between PICAXE and transistor base. Emmiters connected to 0v. Collectors to LEDs via resistor to 5v.
Perhaps I didn't properly explain what the transistors are there for. The collector and emitter will be wired directly to the controller, in order to simulate a button being pressed when the PICAXE output is high. I am not trying to turn the LEDs on using the transistors. The LEDs are there as indicators for when the switch is being "closed" by the transistor. Like I said in my post, I know that a resistor is required between the PICAXE and the base, but how do I know what value to use? The example in the manual uses 10k, is that OK in this situation?


Thanks for your help!
 

BeanieBots

Moderator
If you make A0 - A2 low, that is address zero and the example I2C commands will work. If you use any other address, you need to add that offset to the I2C address used. (just make them all low and you'll be fine)

As for your LED/transistor arrangement.
Without a COMPLETE circuit diagram, impossible to advise any further.
Your current diagram shows 'e' & 'c' floating so it is not possible to determine base current or LED current and hence impossible to calculate R value.

Please note, a transistor is NOT some magic on/off switch like a non-mechanical relay. It is a current amplifier where the 'c' to 'e' current is proportional (amplified by a gain called hfe) to the 'b' to 'e' current.
 

chigley

Senior Member
As for your LED/transistor arrangement.
Without a COMPLETE circuit diagram, impossible to advise any further.
Your current diagram shows 'e' & 'c' floating so it is not possible to determine base current or LED current and hence impossible to calculate R value.
The controller buttons use the pads pictured below:



When the two black semi-circular pads making up each circle are shorted, this induces a button press. One of the semi-circular pads is at 0v (emitters will be soldered to these) and the other is somewhere in the region of 1-2v (this is where the collectors will be soldered), but I can't test the exact voltage for a couple of days.

Do I need to wait until I can test the exact voltage before I know the resistor value? Or am I completely on the wrong track?
 

chigley

Senior Member
An updated schematic.



I've decided to use 4066 logic instead of the transistors for the buttons, as I realised that the pads weren't at 0v like I thought they were. I've stuck with the transistors for two of the outputs (the triggers), as the transistors will work in these two cases.

Two questions this time:

  • I used 10k resistors on the transistor bases, is this OK? Still unsure as to how to calculate exactly what the value should be.
  • Will the 330r resistors on the 4066 control pins cause any problems? Don't think they will, but just wanted to check!

I also have a few queries about EEPROM data organisation, but don't want to get ahead of myself. Once I have the 18X interfaced with the controller correctly, with control over the 5 outputs, then I'll start to add in the EEPROM.

Thanks for your time!
 

BeanieBots

Moderator
Hmm... you really are missing some fundamentals here!

Glad to see you (somebody) has decided to go for analogue switches. It would have been my suggestion for such a circuit.
The enable pins for a 4066 are very high impedance. They will not draw any significant current so the LEDs will not light.
Also, the LED volt-drop will probably be high enough to prevent the switches from being enabled. So, in all probability, neither will work.

Wire the switch enables direct to the PICAXE outputs so they see full and proper logic levels.
If you also want LED indication that they are on, add the LED (with series resistor) to the PICAXE output in the 'normal' manner.

10k for the other transistor bases?
Dunno, depends on the transistor hfe and what it needs to switch.
The datasheet for the transistor will give a figure for hfe and the circuit of what it needs to switch will give the required current.

You could of course just try it but I'd GUESS that a bit lower might be required.
 

chigley

Senior Member
Hmm... you really are missing some fundamentals here!
Haha... which fundamentals am I missing? I'm trying my best! :p Got to start somewhere eh? I enjoy it, even if I fail at everything I attempt!

The enable pins for a 4066 are very high impedance. They will not draw any significant current so the LEDs will not light.
Also, the LED volt-drop will probably be high enough to prevent the switches from being enabled. So, in all probability, neither will work.

Wire the switch enables direct to the PICAXE outputs so they see full and proper logic levels.
If you also want LED indication that they are on, add the LED (with series resistor) to the PICAXE output in the 'normal' manner.
Yes I've tested the 4066 since my last post, and the LED didn't light. I'll try what you suggested next time I have my stuff out.

10k for the other transistor bases?
Dunno, depends on the transistor hfe and what it needs to switch.
The datasheet for the transistor will give a figure for hfe and the circuit of what it needs to switch will give the required current.

You could of course just try it but I'd GUESS that a bit lower might be required.
10k was a complete guess based on the example in manual 3! The hFE values in the transistor datasheet vary on the current (10µA = 150; 2.0mA = 290; 100mA = 180.) Manual 1 says that each output can source 20mA, so does that mean that it's somewhere between 180 and 290?

Thanks again
 

chigley

Senior Member
Thanks electic.

I've read your top link before in the past, but not the second. I won't be able to do the sums until I can test the voltage of the pad which will be wired to the collector.
 

BeanieBots

Moderator
The hfe figures are for collector/emmitter curent. It has nothing to do with whatever current a PICAXE output can deliver.
It comes back to whatever your LOAD current is.
Once you know the load current, you can get the hfe value.
Divide the load current by the correct hfe to get the required base current.
Use the minumum hfe value given.
Then double the calculated base current to ensure full switch on.
Then calculate (ohm's Law) the resistor value required to give the required base current.
(TIP: don't forget the 0.6v Vbe loss when calculating R)
 

chigley

Senior Member
The hfe figures are for collector/emmitter curent. It has nothing to do with whatever current a PICAXE output can deliver.
It comes back to whatever your LOAD current is.
Once you know the load current, you can get the hfe value.
Divide the load current by the correct hfe to get the required base current.
Use the minumum hfe value given.
Then double the calculated base current to ensure full switch on.
Then calculate (ohm's Law) the resistor value required to give the required base current.
(TIP: don't forget the 0.6v Vbe loss when calculating R)
It all sounds very complicated to me - and I don't fully understand it. Nothing I can do now until I am able to test the voltages which will be wired to the collector of the transistor, right?
 

BeanieBots

Moderator
It's not complicated really. Just Ohm's Law and little bit of multiplication and division.
Testing the voltage on the collector won't help you!
You need to know the LOAD CURRENT.

Replace the collector with your ammeter and measure the current when it pulls the line down to 0v just like the collector would do when it is turned on.
OR, from the circuit of the load, work out what the current would be.

EDIT:
OR, just be damned just like everyone else that can't be bothered and stick in 4k7 and hope it's enough.
I'm just trying to get you to learn and understand how it all comes together.
 
Last edited:

chigley

Senior Member
Just spotted your edit, BeanieBots. For the time being I've put 4k7s in (as you'll see below) but I'd much rather test it and do it properly. I still can't test the load current yet though.

I've spent all afternoon trying to come up with a stripboard layout for the circuit. It's been a very frustrating task, as I like to be as obsessively neat as possible (not quite convinced that I've achieved that here though!) I actually started from scratch twice too! Anyway, here's what I've come up with:



Are there any mistakes that I've missed? Note that in a couple of cases there are cut tracks beneath resistors, they're not easy to see! Have I wired the LEDs correctly, such that the 4066 will function and the LEDs will light when the single output is high?

I'm not bothering with the EEPROM for the time being. I've left the outputs free (marked with text labels) so that I can add the EEPROM in once I have the circuit correctly interfacing with the controller.

Any feedback on the stripboard appreciated :) I know that it's a lot bigger an an expert could make it, but size isn't that much of an issue here, and after 3 attempts I wasn't prepared to try again and make it smaller!
 

BeanieBots

Moderator
Well, it's very neat and tidy but I'm not going to check the whole circuit out for you but you have the right idea with regard to the LEDs.
Personally, I'd use a higher value resistor. 330R is the lowest value you should use. Such a low value might drop the OP voltage a bit and possibly cause issues with the logic levels seen by the 4066. Try 1k, you'll hardly notice the difference in brightness.

If you plan to add I2C EEPROM later, you have not made it very easy to do so.
The SCL/SDA lines need to be pulled to 5v via 4k7 and go to the EEPROM.
Might be a good idea to fit the resistors and EEPROM socket now rather than mess-up your board later. Simply don't plug in the chip just yet.
 
Last edited:

chigley

Senior Member
Thanks for such a fast response!

I'll change resistors to 1k when I get home. With the EEPROM, I was just going to have jumper wires going over the top of the board. The programme I'm using to do the layout is so difficult to use that it'd take forever to do it using tracks at this stage. I might give it a go if I get bored between now and the arrival of my 18X.
 

BeanieBots

Moderator
Loads of space for the EEPROM below the LEDs.
Shouldn't be too trick to add.
just a few tracks and two resistors!

I'd hate to see your lovely neat board turn into a birds nest with IC sockets hanging off after all the effort you've put in. Just a little more and you're there!
 

chigley

Senior Member
I might give it a go!

It's the fact that the programme is so difficult to use that's putting me off! Would be worth it in the long run though.
 

chigley

Senior Member
If I start doing more projects, I'll get better paid-for programmes. It wouldn't be worth the investment at the moment.

For the time being, I've worked out a route for the EEPROM connections :) Will do it first thing when I get home!
 

chigley

Senior Member
My updated (and hopefully final) stripboard layout.



Let me know if you can see any problems! And thanks for all of your advice.

Charlie

EDIT: Updated image as I'd forgotten to change the 330r resistors.
 
Last edited:

BeanieBots

Moderator
Can't see anything obviously wrong but I've only spent a few minutes going over it and only around the EEPROM & LED sections.
Next step, build it:)

How will you be powering the board?
Would you want the regulator (plus caps) on there?

Oh yes, that's what's missing. A decoupling capacitor for the PICAXE.
100nF as close as possible (electrically) to the PICAXE power pins.
 

chigley

Senior Member
Can't see anything obviously wrong but I've only spent a few minutes going over it and only around the EEPROM & LED sections.
Next step, build it:)
Good stuff, thanks for taking a look! I'm building it tomorrow, but I won't be able to solder the wires to the controller (coloured rings on left) until Wednesday. This means that the collectors for the two transistors will be floating whilst I'm playing with it tomorrow. Would this kill the transistors if I switched them on? If yes, I won't put them in until I'm ready to wire in the collectors.

How will you be powering the board?
Would you want the regulator (plus caps) on there?

Oh yes, that's what's missing. A decoupling capacitor for the PICAXE.
100nF as close as possible (electrically) to the PICAXE power pins.
Tomorrow I'll be using 4.5v from AA batteries. When I get round to interfacing with the controller I'll power the board from the controller (it's 5v USB powered.) No need for a regulator.

Is the capacitor a necessity? Is it just noise reduction? I don't have any at home, so it'd mean ordering one and then waiting even longer!
 

BeanieBots

Moderator
Turning on the transistors with open collectors will not be a problem.

Is the decoupling required?
Hmm... You might get away without but it should be INSTINCT to fit one.
Technically, you should also fit one on the EEPROM and the 4066 but just one on the PICAXE should be OK.

It IS for noise suppression but it is to suppress the noise created by the PICAXE more than it is to suppress any noise getting to the PICAXE.

Try without but fit one as soon as you get one. Just because it works OK without today, doesn't mean it will tomorrow. As your batteries get flatter, the noise problems get worse.
 

chigley

Senior Member
I'll get a few in my next component order then! I think I read in another thread that it's ceramic, right?

It's going to be hard to solder it close electrically, unless i put it over the top of the chip, but then it'd look bad - I've put so much effort into not needing over-board wires too! Would putting it across the two power rails at the top be too far away from the PICAXE?
 
Top