Output Devices

Have you:

  • [x] Described your design and fabrication process using words/images/screenshots.

  • [x] Explained the programming process/es you used and how the microcontroller datasheet helped you.

  • [x] Outlined problems and how you fixed them

  • [x] Included original design files and code

Making the 16x02 LCD screen work with the SparkFun SerLCD Backpack and the ATTiny 44 - 2021

Group Assignment

I measured the power consumption of the 16x02 LCD. I used a breadboard and wires to connect the following Pin 2 and Pin 15 to 5V from a power supply. I connected Pin 1, 3, and 16 to GND from the power supply. I was able to get a current measurement without the multimeter.

I found a diagram on how to connect the multimeter to measure current in a series. The red wire from the multimeter connects from the 10A port on the left hand side to the 5V from the power supply. The COM port connects to the VCC on the breadboard. The breadboard is grounded to the power supply. The readings were consistent between .01 - .02 Amps.

For the power consumption, I calculate P = I*V (power equals current times voltage). The result is .11W = 5.5V * .02A.

Individual Assignment

The fabrication of these boards is covered in Electronics Design:

In order to get the 16x02 LCD to work, I first followed the Adafruit tutorial:

The component can do 8-bit and 4-bit communication. The tutorial focuses on 4-bit communication.

I set the pins for 4-bit communication in the code. After reading through what would cause the garbled text. I decided to alter the example sketch in Arduino IDE by adding a delay in each loop. This is to counter the nibble loss which causes syncing errors with the LCD. After the delay, the LCD gets reinitialized.

During my visit to Beach Lab in Sitges, Francisco gave me a SparkFun SerLCD backpack that interfaces with LCD screens based on the HD44780 controller. The backpack has a PIC16F688 microcontroller that uses UART for communication. RX is through RB2 which is an input/output pin, SPI data output pin with USART asynchronous receive or synchronous data.

SerLCD Datasheet:

SerLCD Schematic:

PIC16F688 Datasheet:

The goal is to use the board that I fabricated at Beach Lab to communicate with the PIC16F688 on the SerLCD backpack to output a string of text. That current design exposes PA3 from the ATTiny 44 which I hope to use to facilitate the UART communication. PA3 is ADC3 (Analog to digital converter, channel 3), T0 (Time/Counter 0 counter source), and PCINT3 (Pin change interrupt source 3).

I also have PA5 and PA6 exposed through a six pin connector as RX and TX respectively.

The question is whether or not I can use PA3 for UART communication. I found “Getting started with UART” from Microchip online which had example code for a “Hello World!”. The code example is on page 9 of the document. I copied the code into Atom and adjusted two lines:

PORTA.DIR &= ~PIN1_bm; // set RX to PA1
        PORTA.DIR |= PIN3_bm; // current board uses PA3, set TX to output

Link to Getting Started document:

I modified a make file from the Fab Academy examples and flashed my board with the Tiny ISP.

I tested the results with the Sparkfun FTDI Basic 5V. I had to make sure that I had the latest FTDI drivers, aswell.

Link for drivers.

The SerLCD defaults to a 9600 baud rate. I set the bit_delay_time in the code to 100 for this. Because the backpack was not soldered to the LCD screen, I added four lines of code above the while loop in the main function to configure the backpack. I then tested sending the special commands to turn the backlight on and off. That was a success.

After reading the backpack’s documentation more, I noted that a splash screen shows during the boot. I also noted that there is a potentiometer built in. I adjusted the potentiometer with a phillips screwdriver and got the splash screen to display.

I hard coded the buffer in the code to the string that I wanted to print. I had success in getting that to print.

After reading the documentation I noticed that there are two command characters. Hexadecimal 0x7C is sent before configuring the backpack and its backlight. Hexadecimal 0xFE is sent before sending extended commands. There appears to be a problem with sending 0x7C and 0xFE in the same program.

  • Design files: Right click + Save As

  • Hero Shot - 2018

    Current iteration of LCD interface.

    Fabricating the Board

    Milling out the LCD board:

    Copying the traces by connections via GIMP. Process detailed in Feb 28: electronics design.

    Routing the board in Eagle. Process detailed in Feb 28: electronics design.

    2018 Class Notes

    Types of output devices covered in this class: lights, video, sound, and motors. On electrical safety, it doesn't take much current to do serious harm. Outside of the body, it takes a M ohm to go internal. A kilovolt per millimeter leads to dielectric breakdown, which discharges through skin or wires.

    Big power supply capacitors stay charged for a long time. Inductive flyback can happen in solenoid when you switch them on and off.

    For the homework, use power supplies. Open frame supplies come in two kinds. Switching makes noisy power. Linear supplies make cleaner power, but they are more expensive and generate more heat. Benchtop supplies are regulated. The group assignment is to measure the power consumption of your output device. A regulated power supply has a knob which sets the voltage or current. A sense resistor at .1 ohm can be used to measure with an oscilloscope.

    For RGB LED, the part has three light emitting diodes and cathodes with a common anode. Current is alphabetical, it goes from anode to cathode. For the board each cathode has a resistor going to a pin. A pin on the processor can sink ~50 mA. The resistors set the current. The blue cathode is less efficient than the other two cathodes. Therefore, a smaller resistor is set on that pin.

    For LED array, you can use a trick called Charlieplexing. LEDs can only conduct in one direction. Wires can go to rows and columns. Pins can be disconnected. Pins can be low which means current goes in. When the pins are high, current goes out. For n pins, you can drive n x n - 1 LEDs. This can be done additively with a combination of NC mini milling and vinyl (epoxy and copper tape).

    For LCD modules, four pins are for data the others are for controlling the LCD. In the code, the process is to initialize the LCD. There is a very particular sequence. To talk to the module, there is a very particular sequence to toggle. PROGMEM accesses the Flash memory. Organic LEDs are creeping down in price and give you more pixels.

results matching ""

    No results matching ""