Journal 2017/04/27

20170427_095350

This is the new print for the keypad.

it comes at 120mmx65mm with a 5mm difference in between each hole. The holes were 14x14mm. The difference between at the last print was that i fileted the holes, this didnt’ allow the keyswitches to properly slot in. So I’ve been using the power tools in the back in order to make them fit. Currently 3/4 holes work nicely but the last one will take little bit.

Advertisements

Journal 2017/04/25

arduino_official_logo__

My previous problem of not being able to upload the code was solved when the drivers for the nanoboard were installed.

This allowed me to successfully upload the code to the nanoboard.

 

Now that Ive uploaded the code to the nanoboard I need to wait for the wires to come in, in order to solder them to the keyswitches

I used this code as a test.

#include <Bounce2.h>

//Pins
#define led1 2 //led 1
#define led1n 3 //negative so wiring can be neat
#define led2 5 //led 2
#define led2n 4 //negative
#define ledL 13 //led L is on pin 13 on a uno
#define key1 6 //button pin 1
#define key2 7 //button pin 2
#define key1v 29// Letter Z, values from http://www.win.tue.nl/~aeb/linux/kbd/scancodes-14.html
#define key2v 27// Letter X, v for value
//Alternate keys:
//#define key1v 6// Letter C
//#define key2v 25// Letter V

//states
boolean state1 = true;   //if button1 has not been pushed
boolean state2 = true;   //if button2 has not been pushed

//creating bounce objects
Bounce debouncer1 = Bounce();
Bounce debouncer2 = Bounce();

void setup()
{
Serial.begin(9600);

//So you don’t need a resistor
pinMode(key1, INPUT_PULLUP);
pinMode(key2, INPUT_PULLUP);

//attaching the buttons to the bouncer
debouncer1.attach(key1);
debouncer2.attach(key2);

//time in Msec to wait to remove bounces, 3-8 Msec is good
debouncer1.interval(3);
debouncer2.interval(3);

pinMode(led1, OUTPUT);
pinMode(led1n, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led2n, OUTPUT);
pinMode(ledL, OUTPUT); //LED L onboard

digitalWrite(led1n, LOW);//ground
digitalWrite(led2n, LOW);
digitalWrite(ledL, LOW);
}

void loop() {
//check button push state
debouncer1.update();
debouncer2.update();

if (debouncer1.read() == LOW & state1) { // Send keypress
buf[2] = key1v;//starts from array 2
Serial.write(buf, 8);
digitalWrite(led1, HIGH);
state1 = false;
}
if (debouncer1.read() == HIGH & !state1) { // Release key
buf[2] = 0;
Serial.write(buf, 8);
digitalWrite(led1, LOW);
state1 = true;
}

if (debouncer2.read() == LOW & state2) { // Send keypress
buf[3] = key2v;
Serial.write(buf, 8);
digitalWrite(led2, HIGH);
state2 = false;
}
if (debouncer2.read() == HIGH & !state2) { // Release key
buf[3] = 0;
Serial.write(buf, 8);
digitalWrite(led2, LOW);
state2 = true;
}
}

 

I will end up editing it in order to better fit my keypad

Journal #15 2017/04/21

arduino_official_logo__

Due to the ardunio not uploading the code correctly, Ive had to spend time looking over resources such as the sainsmart ardunio setup wiki and the sainsmart website.

My original thought was that I was uploading it to the wrong clone, the ardunio UNO so I switched it up to the Ardunio Nano but It still wasn’t uploading. So far Im at a loss at what I should do.

My current plan is to scour the sainsmart wiki but also to look through other peoples projects that involve the same board.

It could also be the usb might be faulty for whatever reason so I plan to try using another one.

Journal #14 2017/04/21

This week I got a start of the panel printed and managed to slot in the keyswitches for the keypad. The main problem I currently have is that I misjudged the spacing between the keys. 20170421_104524

Due to the overture in spacing this allows me to reduce the whole size of the case. This is benefitional but now size is no longer the main issue.

Now the main issue is the error that the ardunio ide gives when I try to upload the code to the nanoboard.

Journal #13 2017/04/19

WordPress Updatethinking

Problem solving Strategies

  1. Using Wiki and external sources. This is something that will remain relevant to my project as I struggle to find out how to upload code to my nanoboard. http://wiki.sainsmart.com/index.php/Tutorials#Ariduino This is a wiki that I will be using to find out what my board is a clone of and also how to ensure that I’m properly uploading code.
  2. Help from peers and teachers. During my time spent on my projects I have been fortunate to gain assistance from a number of classmates. For my main project, Adrian has shown me his plans and has made suggestions to better my own. Another classmate helped me edit the code for the miniproject I did.
  3. Trial and Error. This allows me to test multiple designs for my case and other things that may come up. My first print of the case allowed me to slot in the key switches nicely, but the design of it was unideal. The spacing between each key was about 10mm more than I would like. Therefore this first attempt has helped me problem solve and also shown me the flaws and rights of what I have
  4. Identifying your problems. Without taking a good look at your project and figuring out the issues, you won’t be able to fix it. The use of identifying and planning for the problems will help more than trying things willy nilly.
  5. Using previous experiences to expand on the project. For example if someone has worked with electronics before than you can draw ideas from that. Or if you have old code you can use for base of a project.

Mini Projects.

Personally this time I did some mini projects and also can use resources to find more that I would like to do.

  1. Using a card counting algorithm, I created a program to track the probability of winning your hand in blackjack.
  2. http://www.instructables.com/id/DIY-PORTABLE-POWER-BANK/ a DIY charger
  3. I spent time designing and redesigning the case for my main project.
  4. http://www.instructables.com/id/Minitaure-Weather-Station-ESP8266/
  5. http://www.instructables.com/id/Battery-Capacity-Tester/

Journal #12 2017/4/12

I spent more time making changes to the case, currently it came down to adding radius to the edges of the case.

20170412_103208

These Changes were made in order to allow for the print to go more smoothly. Currently the top portion of the case is not to be printed instead I created a test plate in order to determine whether the key switches will fit in plate.

20170412_103217

The edges of the plate are curved but the inside squares are not, this allows for the possibility of shrinkage. This forces me to test different dimensions until it works.

Journal #11 2017/04/11

arduino_official_logo__

This week I revisited the ardunio Ide sketch and uploaded it to the SainSmart Nanoboard

Currently Im awaiting the remaining parts of the project (Some Wire and The O-Rings.)

In the meantime I will have to work on the case and continue with that.

Here is the revised sketch for the nanoboard.

https://www.dropbox.com/s/q2idhg9ef19l9es/F4W48M4IGQTZOOJ.ino?dl=0

(original code from an instructable but i edited it to my needs.)