Day 1 with the 4D Systems Intelligent LCD: Fail.

First off, I can point fingers, you can point fingers, who cares.. the fact is I’m pretty underwhelmed by my first day with the “Intelligent LCD”. I purchased the 4D Systems uLCD-43PCT LCD based on a SparkFun YouTube video describing how to use the product and associated software.This product is “intelligent” because it has it’s own processor and serial interface. The idea is to build the interface in software on your PC, drop it on a flash card and program the display.. then just use some simple serial commands to update the display, offloading all that work so I can add this to simple PIC projects with ease. By the p/n you can tell I got the 4.3″ LCD with capacitive touch screen.

I ordered the LCD second day air from Mouser ( @MouserElec ) because they offered the best price I could find. ($190+20) On the YouTube product review, Nick at SparkFun mentioned that he was using the 4D Systems USB to serial adapter because Spark Fun’s doesn’t work and can damage it (due to wiring?). I checked the specs and it says the LCD is 5V tolerant. I used my USB to serial adapter (TTL serial) which works great with PICs as long as they’re 5V tolerant. Well unfortunately, no luck… I can tell the LCD is communicating in some fashion because with a terminal client and with the terminal client built into the “Workbench” software (wasn’t that the name of the Amiga OS?).. in both programs I could enter carriage breaks or other characters and get some serial response from the LCD (usually NULLs (0x00).).. so there is some communication going on.. but the Workbench software itself declares the LCD is not attached. I also confirmed some communication with my logic analyzer. I ordered the 4D systems USB converter from Sparkfun and now I’m back to waiting. How lame.. if you really-really need a specific adapter why not just include it? what is the BOM on something like that? $1-2

I guess I’ll find out in a couple days when my Spark Fun order comes in. I was really hoping to get my display loaded. I spend a few hours on Sunday and Monday tweaking my design… TBC.

01ac1faae7f7a345fcea704ccb59b096fffb9fc41e 019f6ccc9d33cd592d6fa150307fb3f9bed275f037 0129ce0b8710388f61d5c50c95fcf4ec4ab9e0d820

Experiment: TCN75A Temp sensor investigation

I covered the TCN75A i2C sensor a few weeks ago in a simple test to practice using I2C. I had never used I2C before and I knew it was time to stop avoiding it and jump in if I was going to use some of the fun chips and modules. Shortly after posting my results and code I jumped into @tymkrs IRC (visit their site if you’re curious) and Victor ( @vicatcu ) must have at least caught the article subject as he asked me if I noticed the chip runs a little warm (I think he mentioned roughly a deg C?). I had also noticed that oddity myself but I ignored it as I was only concerned with the actual communication. Victor  ( @vicatcu ) posed the question: what would happen if I had a vented circuit board? Would that cure the chip from running hot?

Well that was half-brilliant wasn’t it? I had to know! Does under chip venting on the PCB effect temperature readings? I decided to purchase more sensors and SOIC break out boards as well as make sure my Fluke 51 was calibrated.

Upon receiving the SOIC breakout boards I took one and carefully used a Dremel to mill out the package outline. I had started to design my own PCB  but I abandoned that because I didn’t want to wait for fabrication. I mounted the new sensor on it’s vented PCB then plugged the sensors right next to each other on breadboard and put the temperature probe wedged between the boards. Obviously factors like mounting the sensor near power transistors or near your power supply are always going to have some effect on your readings, and in some cases maybe that’s what your application is meant for. I wanted to take those factors out of the equation. My workshop heating and A/C was off for over a day when I did this test… no windows where open and the chips had been prepped for about 1/2 hour on the board while I wrote the code to test them out. I decided to read data straight from the I2C bus with some confirmation on RS-232 telemetry. I did this in case I introduced any math problem in my conversion in code. I also stuck with Celsius over Fahrenheit because that was the native output of the sensor.

SOIC breakout board with vent cut into it
SOIC breakout board with vent cut into it
The setup of the initial test.
The setup of the initial test.

After downloading code and checking everything out my Fluke 51 read 25.8 deg C, the un-vented TCN75A read 26.06 deg C and the vented TCN75A read 25.81 deg C. Over time the un-vented sensor would measure up to 0.400 deg C away from the other two. It’s not 1 deg C but it is something.

The TCN75A boards are back to back with the K type probe between them. To the bottom right you see the I2C pull up resistors with the logic analyzer tied to them. The PIC16F1509 is just to the right.

Temp sensor telemetry
Temp sensor telemetry; don’t mind the calculator. I was confirming a hexadecimal I2C address.

Test #2, a muffin fan…. same set up. No real change; roughly the same results.

Test #3! What about a change in temperature? I grabbed a cardboard box, put my test circuit and a bowl of ice with some water in the bottom of it, with a muffin fan blowing into the bowl and covered the whole thing in with saran wrap. Not the most insulated thing but I was only looking for a couple degrees. The test proved interesting… both sensors had some lag, and the venting only offered some minor help. It caught up first but they still have a fair amount of lag over the K type probe. In the graph provided I measured at even intervals over 15 minutes. The box settled out at the end (not enough insulation I imagine) the temperature flattened out so I dropped that data.

The Fluke 51 with K type thermocouple vs the normally mounted and modified mounting TCN75A temp sensors.
The Fluke 51 with K type thermocouple vs the normally mounted and modified mounting TCN75A temp sensors.

I can live with the results. I think if I were going to design a board where I wanted as close to an accurate temperature as I could get with this part I would definitely have a milled vent. In hind-sight I would make the vent so it is along the chip axis and protrudes past the edges of the chip. Thanks again to Victor for the great idea!

Weller WD1001 and other updates

I’ll get the “other” updates out-of-the-way before talking about my new love! I’ve collected a solid number of PIC development boards over the last couple years and in about 3-4 weeks I’m going to do a review over what I have collected and what I’ve liked and disliked about them. Do you have any suggestions on a board I just can not miss? I am not sponsored, nor do I collect any money from blogging so I’m not going to buy dozens but I’d be willing to buy a few additional boards if someone has been holding off on pulling the trigger on a purchase. I’m not much of a “review” type person but I’m passionate about development boards for prototyping and I would hope my review would help give someone something to think about before purchasing something for their first or second project; PIC based or not. E-mail away!

It’s a changing of the guard on my bench. My beloved EC1002 is being replaced by the WD1001. It took me a while to decide on the WD1 platform. I decided on the WD1001 over the WD1002 strictly based on the pencil. The WMP appears to be more helpful for small circuit soldering. The WD1 base is very robust, it could be used as a weapon in a pinch. They cord to the pencil appears like it’s made from something that’s near impossible to tangle and is very flexible. The stand… a dream. The only thing it was missing out of the box was a connector to ground it. There is a base connector attachment which appears to be a 1/8″ mono tip/sleeve audio-type jack. I’ll just have to build something myself. Otherwise I’m in love with the purchase.

Weller WD1001 boxed

@whixr was really trying to sell me on the Hakko FX-888… he is in love with his. I did consider the purchase despite feeling like the blue/yellow made it difficult for me to take it seriously as a tool. They have a new silver version; Perhaps I’ll buy one to test out and send to my brother. I was also seriously considering Metcal.. but after a little I can tell I’ll have no regrets with the WD1002.

Old and New

Adam Fabio was definitely on team-Metcal and he just about had me sold. It all boiled down to a review of the WD1001 on YouTube and how agile that pencil is.

Check out how close you are to the work with that WMP handle! I really feel in control.

The handle and tip perfect for up-close small work!

 

Not the most exciting thing in the world, but a good iron really makes like easier. I put my time in with 25 and 35 watt wall corded pencils. The old radio shack models, even the 35W weller… nothing beats a nice thermostatically controlled station.

Project Update: Spunk The Annoying Robot

The last robot I built was a Roomba Sumo Robot (Talos) for a small competition with co-workers. While collecting parts for this little eBay robot platform I got for somewhere in the neighborhood of 15$USD, I grabbed my Pololu motor controller and remember that I wrote that whole Sumo robot in ASM; that was a lot of code between two PICs.

The little robot I’m building now has very few specifications. It’s goal in life is to follow you around, but not too close. It should back away when needed and basically run around, pausing for a while in its search for someone to follow around. My wife named it Spunk because she’s certain to be the one it annoys most.

I’ve built the project as seen in the photo and written all primary code.. ordered a lot of battery management parts to see what I like the best. Determined I can’t get the robot to “find” people with the sensors I have, so I ordered more… so this little guy is half-done. I’ll shelve him until more parts arrive. I really only grabbed it down as it was 4 projects deep in the to-do list because I haven’t kept up with pre-ordering parts, or worse.. ordered the wrong things. I’m still on the hunt for a better display for the WX radio, ordered items for my RS-485 project, etc. etc..

The heart of Spunk is a PIC 18F14K22 on a TAUTIC 20 pin development board. Maybe Jayson ( @TAUTIC ) needs to pay me for all this advertising? 😉 jk.. I just bought a couple of the boards because they fit my type of prototyping perfectly. This was my last one… time to make an order over at @tindie for some more.

Spunk getting probed.
Spunk getting probed.

For now, no code. I’ll post the old ASM code for the Pololu motor controller and the C code as well once it get it properly commented and make sure it at least mostly works. Once I do some real roving tests I’ll throw it on YouTube (and maybe the first tests of Talos as well)… TBC for now.

Checkout: @tymkrs MIDI In Me + PIC18F14K22

I don’t want anyone thinking they’re going to see a bunch of music related items on the blog because I’m really no good at such things. My brother on the other hand is very talented and we recently decided he needed some more MIDI toys. A lot of his music is already created with the help of MIDI.

MIDI is “Musical Instrument Digital Interface“; a standard that defines hardware and protocol. If you want more information on it such as specifications Google is your friend.

My brother had some information on the specification but not really anything that helped me much. I did a lot of reading on the specifications on the MIDI Manufacturers Association webpage and then countless other sites describing the protocol in length. It even looks like there is a tutorial on the Arduino site, although I didn’t look at it because I don’t use them. Again, I’m not going to go into the protocol anymore than I discussed the specification. I’ll let you do that leg work. However, the *really* short version is there are a couple key commands followed (usually) by some extra bytes (generally 1 or 2). All the data is transmitted like normal 8N1 serial data at 31.25kbaud. Lucky for me 31.5k has a nice PIC SPBRG division value for low error rate (at 4MHz).

Hardware Interface: I decided I wasn’t going to build the 5mA loop interface and I remembered the Toymakers ( @tymkrs ) had a nice little interface board already built. One trip on over to their Tinde Store and I had it a few days later.

It’s a small kit, it came well packed, and it fit the bill just fine. I have nothing but praise this little kit with only one tiny little nit-picky mention. I wish they included a URL of the location of the instructions for building the kit. They had a couple resistors and I needed to know what was R1, R2, etc.. it was easy to find, a return trip to Tindie linked instructions, a construction video! and a lot of information on their website. So I know I’m picky.. If they wanted to make a 9.7 a 10.. that’d be it 😉

The Toymakers Midi In Me Kit.
The Toymakers Midi In Me Kit.

After everything was plugged in, code was loaded on the PIC, a MIDI device plugged in.. etc.. I checked out the MIDI kit to see response and how noisy it might be… no complaints here.. it looked good…

MIDI In signal edge TEK0000

The Firmware: It’s just “sample” code. I haven’t written any real output yet because my brother is in charge of the “analog” bits which really means he is going to figure out what he wants in block diagrams and I will have to figure out how to make it happen in circuit. Right now I’m reading the MIDI signal in on UART by interrupt… and checking for my command signal. (I’m using a Control Change because of my MIDI device… you will most likely want to change this). The control change value is 0xB1 in my case, then… my device (Knob #1) which is 0x11 … and finally it gives me a value (knob position 0x00 to 0x7F). I’m taking that position value and transmitting it out the UART to my PC…

 

The output dropped onto my PC. Note: RealTerm allows me to enter in 31250 baud.. 8N1
The output dropped onto my PC. Note: RealTerm allows me to enter in 31250 baud.. 8N1
MIDI on the LA
MIDI on the LA

 

I used the TAUTIC 20 pin dev board (any groaning of “AGAIN??”??) … but a change-up! 🙂 I used a PIC 18F14K22 … because I felt like getting crazy 😉 and the 18 series is optimized for C so I will probably go back to the 18F series … I think the last time I used one was my ESR meter?  A few changes switching to the 18 series.. but nothing huge. Just getting used to slightly different registers.  Last warnings about the code; It’s simple… it’s just checking to see if your interface it working… (or if you’re sending MIDI and you don’t have a scope or LA). It has a lot of clutter because I was using it for some other non-MIDI related testing but it’s easy to spot and delete if you need to copy it as a starting point for whatever you’re working on. (Do share!)

/* 
 * File:   main.c
 * Author: Charles M Douvier
 * Contact at: http://iradan.com
 *
 * Created on February 8, 2014, 11:39 AM
 *
 * Target Device:
 * 18F14K22 on Tautic 20 pin dev board
 *
 * Project: MIDI Slave
 *
 *
 * Version:
 * 0.1  Configuration, 31.25Kbaud TX&RX
 * 0.2  Grab MIDI byte from 31.25K MIDI and turn around and TX the value of the
 *      MIDI command. <CMD: Control Change><Device><Value>
 *      <B1><11><value> //my example
 *
 */
#ifndef _XTAL_FREQ
#define _XTAL_FREQ 4000000 //4Mhz FRC internal osc
#define __delay_us(x) _delay((unsigned long)((x)*(_XTAL_FREQ/4000000.0)))
#define __delay_ms(x) _delay((unsigned long)((x)*(_XTAL_FREQ/4000.0)))
#endif

#include <xc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//config bits
#pragma config FOSC=IRC, WDTEN=OFF, PWRTEN=OFF, MCLRE=ON, CP0=OFF, CP1=OFF, BOREN=ON
#pragma config STVREN=ON, LVP=OFF, HFOFST=OFF, IESO=OFF, FCMEN=OFF

#define _XTAL_FREQ 4000000 //defined for delay

/*
 * Variables
 */

    long int    decm;           //long temp
    int     tempi;              //temp
    int     i, ilevel;                  //temp
    int     itxdata;            //int RS232 tx data
    char    buf[10];            //buff for iota
    volatile unsigned int uart_data;    // use 'volatile' qualifer as this is changed in ISR

/*
 *  Functions
 */

    void interrupt ISR() {

    if (PIR1bits.RCIF)          // see if interrupt caused by incoming data
    {
        uart_data = RCREG;     // read the incoming data
        PIR1bits.RCIF = 0;      // clear interrupt flag
                                //
    }

}

void uart_xmit(unsigned int mydata_byte) {

    while(!TXSTAbits.TRMT);    // make sure buffer full bit is high before transmitting
    TXREG = mydata_byte;       // transmit data
}

void serial_init(void)
{

    // calculate values of SPBRGL and SPBRGH based on the desired baud rate
    //
    // For 8 bit Async mode with BRGH=0: Desired Baud rate = Fosc/64([SPBRGH:SPBRGL]+1)
    // For 8 bit Async mode with BRGH=1: Desired Baud rate = Fosc/16([SPBRGH:SPBRGL]+1)

    TXSTAbits.BRGH=1;       // select low speed Baud Rate (see baud rate calcs below)
    TXSTAbits.TX9=0;        // select 8 data bits
    TXSTAbits.TXEN = 1;     // enable transmit

    RCSTAbits.SPEN=1;       // serial port is enabled
    RCSTAbits.RX9=0;        // select 8 data bits
    RCSTAbits.CREN=1;       // receive enabled

    //BRGH=1        31.25KHz
    //SPBRG=7

    SPBRG=7;               //

    PIR1bits.RCIF=0;        // make sure receive interrupt flag is clear
    PIE1bits.RCIE=1;        // enable UART Receive interrupt
    INTCONbits.PEIE = 1;    // Enable peripheral interrupt
    INTCONbits.GIE = 1;     // enable global interrupt

         __delay_ms(50);        // give time for voltage levels on board to settle

    //  uart_xmit('S');         // transmit a character example

}

void init_io(void) {
    TRISAbits.TRISA0 = 0; // output
    TRISAbits.TRISA1 = 0; // output
    TRISAbits.TRISA2 = 0; // output
    TRISAbits.TRISA4 = 0; // output
    TRISAbits.TRISA5 = 0; // output

    ANSEL = 0x00;         // no A/D
    ANSELH = 0x00;

    TRISBbits.TRISB4 = 0; // RB4 = nc
    TRISBbits.TRISB5 = 1; // RB5 = nc
    TRISBbits.TRISB6 = 0; // RB6 = nc
    TRISBbits.TRISB7 = 0; // RB7 = nc

    TRISCbits.TRISC0 = 0; // output
    TRISCbits.TRISC1 = 0; // output
    TRISCbits.TRISC2 = 0; // output
    TRISCbits.TRISC3 = 0; // output
    TRISCbits.TRISC4 = 0; // output
    TRISCbits.TRISC5 = 0; // output
    TRISCbits.TRISC6 = 1; // input
    TRISCbits.TRISC7 = 1; // input

}

void set_cmd11(void)
{
    //set an AD output
                while(uart_data==0x11)
            {
                i++; //wait for next char
            }
            ilevel = uart_data;         //finally the value
            uart_xmit(ilevel);
}

void check0xb1(void)
{
    if (uart_data == 0xB1)
    {
            while(uart_data==0xB1)
            {
                i++; //wait for next char
            }
            if ( uart_data == 0x11)     //and the knob 1 is "device 11"... 
               set_cmd11();
    }
}

int main(void) {

    init_io();

    // set up oscillator control register, using internal OSC at 4MHz.
    OSCCONbits.IRCF = 0x05; //set OSCCON IRCF bits to select OSC frequency 4MHz
    OSCCONbits.SCS = 0x02; //set the SCS bits to select internal oscillator block

    serial_init();

    decm=30;            //testing

    ltoa(buf,decm,10);  //long conversion to buffer
    tempi=strlen(buf);  //uh, adding leading zeros..
    uart_xmit('+');
    uart_xmit(itxdata);
    uart_xmit('.');
    LATAbits.LATA0=0;

    while (1) {

        i++;

        while (uart_data)
        {
            check0xb1();    //my midi device is sending a Control Change 0xB1
            uart_data=0;
        }

    }
    return (EXIT_SUCCESS);
}

 

A note on conformal coating

In 1992 I was in high school going to a magnet school half-time for electronics. During the school year we had a regional electronics competition across the valley with all the school electronics programs in area. I don’t remember every bit of the competition; but as you can imagine there was theory, circuit analysis, math, troubleshooting and a practical soldering test. I somehow pulled off first place.. but not without having to pull off a soldering feat! Someone must have donated old through-hole aerospace related PCBs. There was a huge box of PCBs and they all had one ugly thing in common: Every single one had a thick layer of conformal coating! I’m guessing they came from Boeing. I was lucky; I’d run into these before or I’d likely not have won the competition. But I’ll get to that… Conformal coating comes in five (some claim six) types: Silicone, Epoxy, Acrylic, Polyurethane, and I’ll roll it up in “others”. They each have their application depending on your needs.. dielectric strength, flexibility, moisture resistance, etc. I typically use Silicone because it is flexible, and has good moisture resistance. The rest of this conversation is probably best viewed in video; so with that…

warning: this video drags on a little, 9 minutes could have easily been 4. I’m still not great at the whole video thing and I decided just to do this in one take.

Back to high-school days competition; the challenge was simple. Remove a two components and replace with new parts. I had gotten lucky that they had used acrylic coating and I chipped/scraped away most of the conformal coating without much damage or scaring. Everyone else just went and burnt through the coating to de-solder their targets… well as you can imagine it turned into a mess. Mine wasn’t anything I’d nail on a wall but apparently it was enough to be “award winning” 🙂

%d bloggers like this: