Maker Pro
Maker Pro

how to program a Genie 20 pin board with 24 switches

Cross By Nature

Mar 16, 2010
2
Joined
Mar 16, 2010
Messages
2
Hi,

I am currently undertaking an electronics module with which I am having a great many problems:confused:. My lecturer has not got a clue so is unable to help. I am trying to build and program a project board using a Genie 20. The design is to assist budding guitar players with the correct finger placement on the fret board for specific chords.

I have assembled 24 micro switches inside a guitar fret board. The switches have been placed between the frets (6 switches per fret) in the positions were the guitarists fingers would be when playing chords. When the switches which match the finger positions of a specific chord are pressed I want the pic chip to play that particular chord, C for instance. As this is a prototype project I am only going to choose 4 or 5 chords to demonstrate the principal, Chords C,D,E,F,G,A. As the C20 board only has 5 outputs I have bought 2 boards.

I would think the difficulty will be in using some of the switches twice, possibly 3 times as they are used to play more than 1 chord. I have tried to design a program with Circuit Wizard but my sanity is now becoming endangered such is the difficulty I am facing. Please help with your suggestions, advice, circuit diagrams etc.

Very many thanks in anticipation

Regards Steve x x
 

55pilot

Feb 23, 2010
434
Joined
Feb 23, 2010
Messages
434
Is this a school or college project? What level? Is this an engineering class or a music class where the instructor is not really expected to be able to help you with electronics?

Much more importantly, is this a Genie specific question? Are you required to do this on the Genie? If so, you are going to have a very limited pool of people able to help you. I doubt too many people are going to be willing to learn the system just to answer your questions.

From the big picture, your plan seems fairly straightforward and correct. You need 24 inputs into your micro and play the right chord when the appropriate buttons are pressed. The keys have to be dedicated. You can not have a matrix keyboard because a matrix keyboard does not support multi-press. If you do not have enough inputs on your micro, you will have to use a multiplexer to be able to read all the inputs using fewer pins on the PIC. Three 8:1 or two 16:1 multiplexers will be optimal.

Playing a chord may present some challenges because you have to play multiple notes simultaneously. I have no idea how to do any of that on your particular system.

---55p
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
I assume the Genie20 is some sort of microcontroller board. (oh, reading further, it's a PIC board)

What you seem to be attempting to do is to do the coding of switch to chord in hardware and then leave nothing for the processor to do.

The arguably "correct" approach is to allow the processor to read the states of the switches and then determine when the correct switches have been pressed to make up some appropriate chord.

This is the most flexible and allows you to add additional chords later without changing the hardware.

And it's not outputs you need mostly, it's inputs! You need to read the switches.

You need to be able to read the state of the 24 switches, even when several are pressed at the same time. There is a sneaky way you could do this with one input and one output, but you're perhaps better off going for a simpler method (the sneaky way would be worthy of a school project on its own).

Have a look at the 4017 chip. It has 10 outputs, one of which goes "high" at a time. You give a pulse to the clock input to move that "high" output along.

If you imagine connecting a switch to each output and the other ends of the switches together, you can see that only one switch is powered at a time. You can pulse the clock input to move to the next switch, and so on.

Practically it's not that easy, the outputs not pulled high are pulled low, so in the simple scenario I gave, having 2 switches pressed would cause problems. The answer is to place a diode in series with each output do that only a logic 1 can be seen. Logic 0 appears as a high impedance. The common end are tied to earth via a resistor (say 10 K) and the junction of the switches and the resistor is connected to an input.

The next problem is in determining which switch is currently "on". You can either tie an output to the "clear" pin of the 4017, or an input pin to (say) output 1 of the 4017.

In the PIC program you now reset the 4017 and then keep track of how many times you've pulsed the clock pin so you know which switch is being tested.

A single 4017 has 10 outputs, so you can sense 10 switches. For multiples of 10 switches you can connect a second set of switches and use another sense input.

for 24 switches it makes sense (for various software reasons that I *hope* you understand) to have 3 banks of 8 switches.

If you do this properly, you'll need 5 pins -- one for clock, one for sense or reset (reset seems more straightforward) and one each for each bank of 8 switches.

Once you write the code to sense the switches (your code should be able to scan all the keys many (tens to hundreds of) times per second).

The output of this is the state of the 24 switches. After allowing for key bounce, you simply compare this state to the states you have defined for various chords, and then take whatever action you wish to take when they match.

How much time do you have?

An alternate approach, if you are intent on encoding the switches in hardware is to "wire AND" them together using diodes and a resistor. When all switches for a particular combination are pressed, the state of the output will change. At this point you may as well simply buffer it and light a LED, there's not much for a microprocessor to do.

If I were you, and presuming that time is not infinite, I'd wire up sets of 8 switches each to their own 10 way IDC cable with a header socket on the end. 8 of those wires are for one end of the switches, 1 is for the common end, and one remains unused.

With a very little bit of effort, you could wire up a board that these can plug in to to confirm the switches are connected and working (a resistor and a diode for each switch output)

With little additional effort, you can make up a board with the "wired AND" circuit to identify a single chord (maybe you could make up several, each identifying a different chord).

If all that works you could make a board which interfaces a single set of 8 of them to the PIC, then if that works, make up 2 more to allow the full set of finger positions to be sensed.

At any point you have a working project and your progress toward a more complex result is determined by your skill.
 

Cross By Nature

Mar 16, 2010
2
Joined
Mar 16, 2010
Messages
2
Genie PIC chip design problems

Hi,

Many thanks for your replies.

I am currently training to be a design technology teacher at GCSE levels key stage 3 and 4. The lecturer who was supposed to be taking the module has gone off on sick leave with stress. The problem has been that we now have a lecturer who is no wiser than we are, and to think we are paying for this course £3,300 per year + material costs.

I only have until the 14th of April to design and make a product which uses a PIC chip. The lecturer recommended we use a Genie board so that we need not make the actual PCB board, however if we did it would mean higher marks.

I came up with the idea of a guitar tutor which is to be shaped like a fret board with switches between the frets where the guitarists fingers would be placed. When the guitarist makes a successful chord by pressing the appropriate switches the Genie PIC chip plays the chord. Problem is more than one switch relates to several chords. To keep things simple I was just going to use chords D,E,F,G,A.

As I am a complete novice and as never before having worked with electronics I am concerned that my project is beyond me and I am at the stage where I need to consider what I should do. Advice very welcome.

Thanks again

Steve
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Well, I would be seriously talking to the school about having them provide a lecturer who is qualified, refunding your $$$, or deferring the course until they can get a suitably qualified person.

You have almost a month to complete this project. The question is, how much time do you put into this. If it's several hours a day, then you should be able to breadboard something. How's your experience with programming? That will be the biggest hurdle if you have to learn it from scratch -- doubly so if you're using PIC assembler instead of C.

I'm pretty sure that with help you could complete such a project in the time available, but you might not actually understand what you've done. Given it's a project and I'm not getting any part of that £3,300, my assistance will obviously be somewhat limited :)
 

55pilot

Feb 23, 2010
434
Joined
Feb 23, 2010
Messages
434
I agree with Steve. You are paying for a class and they are responsible for providing you an instructor that can teach you. There are many of us that can design this device for you in a matter of a few hours and build it in a day or two. We can even drag you through the motions over a few weeks. But your goal is to learn, not just to put a check mark so you can get a piece of paper.

---55p
 
Top