Show Posts
Pages: [1] 2 3 ... 80
1  Community / Exhibition / Gallery / 4017 IC keyboard matrix controller and library on: Today at 12:56:45 am
I recently came across these articles describing an implementation of one or more 4017 decade counter ICs used to implement a keyboard matrix.
http://www.edn.com/design/power-management/4413677/Connect-a-4-3-matrix-keyboard-to-a-microcontroller-using-two-I-O-pins
http://www.edn.com/design/components-and-packaging/4408027/Read-10-or-more-switches-using-only-two-I-O-pins-of-a-microcontroller.

I thought the idea and approach looked interesting and decided to do a mini-project to test it out.

Diodes isolate the 4017 counter outputs in the event that two or more switches are closed at the same time, allowing simultaneous presses to be detected properly. The number of switches connected can be increased by cascading multiple CD4017 or by using a matrix style arrangement. The nice thing is that at all times the interface to the Arduino remains just 3 pins (Clock, Reset and the digital output from the matrix).  Two counters in a matrix arrangement can be used to monitor up to 100 switches, still just using 3 interface pins.

According to the articles, Reset can be omitted but I decided to leave it in because reliable operation following the initial power-up reset depends on the CD4017 counter’s remaining synchronized with the Arduino counter. This is easiest done by resetting the 4017 at the start of every scan.

I have also implemented a scalable library to read the key matrix using the 4017 IC. The library
- Allows definition of the size of the keyswitch matrix
- Manages the scanning of the 4017 to read the matrix
- Detects the transition from OFF state to ON state for each key
- Implements software debounce and software auto repeat
- Allows detection of multiple simultaneous key presses.

As a proof of concept, and to test the software, I implemented a 3x3 matrix. Attached are JPG images for the circuit, board layout and final product. It works really well and I can see that this keyboard matrix arrangement has the potential to save a lot of I/O pins. Scaling my circuit up top more switches should be straightforward.

The library and all associated documentation, including Eagle CAD files, can be found at my code repository in the signature block below.
2  Using Arduino / LEDs and Multiplexing / Re: MAX7219 + LED Matrix Wiring? on: April 22, 2014, 03:07:42 pm
@Genesis92 - you are correct, 1k is far too low. You should follow the guide in the data sheet for the MAX7219.
3  Using Arduino / Programming Questions / Re: Help me, PWM does not work on: April 20, 2014, 06:24:35 pm
code?

Is the pin you are using actually one of the pins that supports PWM? Not all Arduino pins are PWM capable.
4  Using Arduino / Programming Questions / Re: getting else without previous if error on: April 18, 2014, 08:50:44 pm
You have a semi-colon at the end of the line with if. That makes the else invalid.
5  Using Arduino / Displays / Re: Cant display 8 on my digit display when given the time interval!! on: April 18, 2014, 02:01:42 pm
Blinkwithoutdelay is more multitasking than multiplexing.

6  Using Arduino / Programming Questions / Re: Is a while loop embedded in if/else if legal? on: April 18, 2014, 12:32:36 pm
It is legal syntax. If it is not compiling it is because there is an error somewhere that you have not provided code for.

I am not sure what you are trying to achieve, though, because the same randNumber is being assigned to all your variables. Your loop generates the number a few times but overwrites the variable with each new number.
7  Using Arduino / Displays / Re: Cant display 8 on my digit display when given the time interval!! on: April 18, 2014, 12:26:33 pm
There are a bunch of basics that you need to get under your belt
- Dealing with digitals - reading/writing, pullup/pulldown resistors, using switches
- Dealing with analogs - reading/writing, PWM, voltage dividers (dealing with a whole class of sensors)
- Using the Serial output for debugging
- Learning how to do lots of things without pausing (no delay()) - see blink without delay and learn that technique
- Learn about Finite State Machine style programming

Then it depends on what your interests are - find a project and put it all together into something useful.
8  Using Arduino / Displays / Re: Cant display 8 on my digit display when given the time interval!! on: April 18, 2014, 01:16:07 am
Quote
Please do tell me if there are any additional components I need to add to the circuit to ensure the safety of the digit display
I notice in the circuit that you do not have any resistors in series with the LED. You will end up damaging the LED or the Arduino output as the current drawn will be too high. You need to put a series R with the LED. I would suggest something like 470 Ohm to start with as a safe value. There are lots of resources to tell you how to calculated the R for your LED, it comes up often in these forums.

Also, rereading
Code:
off(0);off(1);off(2);off(3);off(4);off(5);off(6);off(7);off(8);off(9);
your outputs are  pins 0..7 and do not include 8 and 9.

Maybe your LEDs or the Arduino ports are shutting down. with a delay you would notice the 'flash'. Without the delay you are continuously turning them on again and again. If the delay is much shorter (say 20 ms) do they appear dim?


9  Using Arduino / Displays / Re: Cant display 8 on my digit display when given the time interval!! on: April 17, 2014, 03:13:36 pm
1. Not a good idea to use pins 0 and 1 as they are the serial comms pins. Start at 2.
2. The case statement can take any values, including 0 and negative.

Code:
void Dis(int b,int a=7)  // function to define the ports i need to be turned on to display various digits [0 to 9]
{
 off(a);
 b+=1;  // didnt know if 'case' could take values of 0 so i just incremented the digit to be displayed by 1.
 switch(b)
{

The only difference between an 8 and a 9 is one LED segment - could this be connected to output 7 which you are ALWAYS turning OFF in the code above (for no real reason that I can see)?

Also, post your code using the # not the quotation. It makes it easier to read.
10  Community / Exhibition / Gallery / Re: Scrolling LED matrix display - Parola for Arduino on: April 14, 2014, 02:17:14 pm
All the pin numbers are defined in the Parola_Test example. You can change it to whatever you want if they don't suit.
Code:
// User interface pin and switch definitions
#define  SPEED_IN      A5 // control the speed with an external pot
#define  PAUSE_SET   4 // toggle pause time
#define  JUSTIFY_SET  6 // change the justification
#define  INTENSITY_SET 7 // change the intensity of the display
#define  EFFECT_SET    8 // change the effect
#define  INVERSE_SET   9 // set/reset the display to inverse

There is not much to explain about the circuit. Look at other examples on how to connect a pot and a switch to the Arduino. There is a lot already on this forum for these basic Arduino connections, so it is not really worth explaining it again here.
11  Community / Exhibition / Gallery / Re: Scrolling LED matrix display - Parola for Arduino on: April 14, 2014, 06:42:03 am
I am not sure I understand your question. Do you mean the control you see in the video? It is just plain switches and a pot, like are used in most of the simple arduino examples.
12  Using Arduino / LEDs and Multiplexing / Re: Problem with 8x8 Matrix and Parola, nothing displaying... on: April 13, 2014, 02:04:38 pm
I don't think that you can just change the LED modules and expect it to work. The matrix itself is wired differently and the circuit from the MAX7219 chip has to take that into account. The software will then accommodate the different row/column orientation that may result.
13  Using Arduino / LEDs and Multiplexing / Re: Problem with 8x8 Matrix and Parola, nothing displaying... on: April 11, 2014, 06:51:18 pm
Generally common anode or common cathode doesn't make a difference to the libraries except that the module orientation will change. The new version of the libraries includes changes to make the adaptation for novel arrangements much easier.
14  Using Arduino / Sensors / Re: Problem with Color sensor module TCS3200 on: April 11, 2014, 06:21:50 pm
I have a library for the TCS230 which I think works in a similar way to the sensor you have. The library has some example code that allows it to 'recognize' colors which could be interesting for you. See the code repository link below to access the library if you are interested. If you do download, look for the PDF file that explains how to calibrate the sensor.
15  Community / Exhibition / Gallery / Re: Scrolling LED matrix display - Parola for Arduino on: April 11, 2014, 06:14:55 pm
Quote
Can i expand this matrix vertically

You need to explain what you want to do. You can stack the displays on top of each other - that is just a physical layout.

If you want your software to operate as if it was a big screen, then you will need to handle the operations between the 'lines' of display. The ability to define zones has made this much easier - just define a zone for each line.
Pages: [1] 2 3 ... 80