CatsRjERKS

Cats Are Jerks

Description

In this project, a rather unfriendly cat is simulated. An LV-MAXSonar-EZ0 will be the ‘cat’ in this project, reading how close you are getting to it. Using a Speaker and uLCD Display with unique SD cards for each, the state of the cat is displayed.

Components and Libraries

This section is for information about different reusable building blocks; primarily components and the libraries, code and information to make use of them. For more about Libraries, see Working with Libraries.

Import programCatsRjERKS

version one

What You Will Need

  • uLCD-144-G2
  • SD Card Reader from Sparkfun: https://www.sparkfun.com/products/544
  • LV-MAXSonar-EZ0 from MaxBotix
  • Speaker – PCB Mount from Sparkfun
  • 2 SD Card
  • 1k Resistor
  • 2N3904 Transistor

uLCD Display

The uLCD Display has two rows of pins. Use a cable to hook up the breadboard to the row of pins closer to the edge of the display board. +5 V will be the leftmost pin if looking at the board with the label upright.

demo

demo

demo

demo

SD Card for uLCD Display

The SD Card being used is going into the SD slot mounted to the uLCD. This, however, requires some editing upon the SD card. Using the 4D Workshop IDE from this site http://www.4dsystems.com.au/product/10/120/Development/4D_Workshop_4_IDE/

take an SD card and clear its partitions using the IDE’s RMPET tool. Using the same tool, partition the SD card into two sections: 50% FAT and 50% unformatted. Due to the nature of the uLCD display, the JPG files for the Cat images must be stored in the unformatted half of the SD card. After having re-formatted the SD card, resize the JPG files of the Cat, to be 128 by 128 pixels, as these are the dimensions of the uLCD screen. Using instructions from this link with the Graphics Composer tool of the IDE

http://www.4dsystems.com.au/downloads/Application-Notes/4D-AN-G5002-Serial-Displaying-Image-Video-Animation-Goldelox-REV1.pdf

mount the three images to the SD card. In this project, the files being used are NiceCat.jpg, NervousCat.jpg, and AngryCat.jpg. After having stored the images onto the SD card, the Graphics Composer tool will output a .GC file. Here you will be able to find the sectors at which the files are located in order to access them in the code.

demo

The Speaker

The Speaker-PCB mount has the Positive pin hooked up to VOUT of the MBED. The Negative pin is tied to the collector pin of a 2N3904 transistor. The base of the transistor is tied to a 1k resistor that is in turn connected to Pin 18 of the MBED. The emitter of the transistor is tied to GND as shown in the image below:

demo

demo

SD Card Reader For Speaker

For the SD Card Reader holding the WAV files used for each Cat state, the following wiring is used:

demo

In order to ensure that sound files play, WAV file formats are used. The WAV files are mono-channel, sampled at 16 Khz, and saved as 16-bit. If the audio file being used is anything else, a program such as Audacity can be used to format the file to the previously mentioned settings.

In this project, three WAV files were used: NiceCat.wav, NervousCat.wav, & AngryCat.wav.

/media/uploads/Septimus/nicecat.wav

/media/uploads/Septimus/nervouscat.wav

/media/uploads/Septimus/angrycat.wav

The LV-MaxSonar-EZ0

The MaxSonar is relatively easy to set up. For this project the following wiring is used:

demo

Please do note that because the MBED is being used to take in the MaxSonar’s Analog Output, a voltage of 3.3 is being used as the MaxSonar’s power supply. The Analog In for the MBED cannot take anything higher than 3.3 Volts or it will saturate the signal.

Project Wiring Upon Completion

demo

Demo Video


All wikipages