Home » 2018 » January

Monthly Archives: January 2018

Raspberry Pi Case Installation

First remove the sd card. Remove the paper from the heatsonks and place them as shown in the images.

Insert the Pi tilted with the HDMI/micros usb/composite side going first.

Secure the fan with the provided screws. If the wires are too long tape them to the case.

Connect the fan to the RPi 5V and GND. Don’t use 3.3V pin as that’s provided by the CPU and can be damaged.

Put the two shews together and tighten the long screw on the back.

 

 

Buy Raspberry Pi3 case + Fan + Heatsinks

Whac-A-Button With Arduino

Whac-A-Mole like game with Arduino and Arcade style LED buttons.

This is a very simple version of the Whac-a-mole game, where a button lights up and waits for the player to hit it. If the correct button is hit the score is updated and a new button lights up. The player is not punished if they hit the wrong button. Only one button lights up at a time. Time to hit the button reduces each game cycle.

arduino-whac-a-button

Kit includes:
5 LED buttons
All required wires, screws and nuts
Arduino nano
Laser cut acrylic panels
4 digit 7 Segment display TM1637
USB cable

 

Assembly

Start by adding the display and buttons. Make sure the display pins are pointing inwards, the colour arrangement of the buttons is up to you.

arduino-whac-a-button-assembly

Use 2 screws to secure the display in place.

Keep all buttons in the same orientation – it will make wiring easier.

Wiring might look messy but it’s very simple.

Connect all grounds together using the daisy chain 2.8mm crimp connectors. Again if all buttons are in the same orientation it will be much easier. The end with a jumper wire connect to the Arduino GND.

arduino whac-a-mole-wiring

Now connect the rest of the pins as shown in the images below:

Connect the display.

Display –  Arduino

CLK    –   Pin 8

DIO     –   Pin 7

GND    –  GND

5V        –  5V

Arduino TM1637 display

Use jumper wires to connect all LEDs to the Arduino pins.

LED1 – Pin9

LED2 – Pin10

LED3 – Pin11

LED4 – Pin12

LED5 – Pin13

Now use jumper wires to connect all buttons to the Arduino pins. Make sure that if you’ve used for example the green button for LED1 you’ll have to use it as Button1 as well.

Button1 – Pin2

Button2 – Pin3

Button3 – Pin4

Button4 – Pin5

Button5 – Pin6

Tape the wires together to keep them from disconnecting.

Once everything is connected test if it works before assembling the panels.

Code

Download the code from GitHub – Whack-a-button and upload it to the Arduino.

At start the game will be in waiting for input where all LEDs will be flashing until one of the buttons is pressed and that’s when the game will start. After the game ends it will return to the waiting for input state while still showing the latest score and it will stay like that until a button is pressed and new game starts.

After you’ve checked that everything is connected correctly assemble the rest of the panels.

Leave the right panel last as that’s where the usb cable will be coming out.

 

Enjoy your play.

 

Buy Arduino Whac-A-Button Kitarduino-whac-a-button

Using the 8×8 64 RGB LED Matrix With Arduino

64 RGB LED Matrix

 

Buy 8×8 64 LED Matrix WS2812 LED

 

 

 

 

 

 

The WS2812 Integrated Light Source is a full-color LED. Red, green and blue LEDs are integrated alongside a driver chip into a surface-mount package controlled through a single wire. This panel has 64 bright RGB LEDs , arranged in an 8×8 matrix, each pixel is individually addressable. Only one microcontroller pin is required to control all the LEDs, and you get 24 bit color for each LED.

 

Wiring up

There are two 3-pin connection ports – one input and one output to the next panel. Provide 5VDC to the +5V pin and ground to GND pin, then connect the DIN pin to your Arduino. You’ll also need to make a common ground from the 5V power supply to the Arduino. Since each LED can draw as much as 60mA use at least 5V 2A power supply.
You can chain these together. Connect the DIN of the second panel to the first panel’s DOUT. Also connect a ground pin together and power with 5V. You can chain as many as you’d like, you will need a 5V 10A power supply for chaining 4 of these!

Libraries

Using the Adafruit Library

Install Adafruit_NeoPixel via Library Manager

From the Sketch menu – Include Library – Manage Libraries and search for NeoPixel, then click on the Install button. After it’s installed, you can click the close button.

Install NeoPixel Library

Open the strandtest example

Launch the Arduino IDE. From the File menu, select Sketchbook – Libraries – Adafruit_NeoPixel – strandtest

NeoPixel Example

NeoPixel Code Explained

The first line assigns the Arduino pin connected to DIN.

The last line declares a NeoPixel object with three parameters:
1. The number of Pixels in the strip. In the example this is set to 64, change this to match the actual number you’re using.
2. The pin number to which the Matrix is connected.
3. A value indicating the type of Pixels that are connected.

Using the FastLED library

Install the FastLED via Library Manager

From the Sketch menu – Include Library – Manage Libraries and search for FastLED, then click on the Install button. After it’s installed, you can click the close button.

Open the DemoReel100 example and make sure the following lines are set as shown below.

#define DATA_PIN 3     –  the Arduino pin connected to DIN
#define NUM_LEDS 64 – Number of Pixels in this case 64

 

Troubleshooting!

Check your connections. The most common mistake is connecting to the output end of a strip rather than the input – this will light up all leds. Reversing 5V and GND will burn the microcontroller. If only few rows are working check that you’ve set he right number of pixels(64) or rows/columns 8,8 depending on the library you are using. Make sure you are connecting to the pin set in #define PIN.

Other projects – Word Clock