Project Updates, 20140429

Frequency Standard Project:

I took an old milli-volt meter which is long dead and gutted the case. It was a lucky day when I could just flip the face plate over and I had a ready-made front plate for my frequency standard. I got my power supply in yesterday from Digi-Key. It was $19 1470-2284-ND … 15V 50W. I will down convert what little 5V power I need off that. AC is wired in, tested, power supply is good to go. I have only thought of one addition to just the basic standard. A phase detector. I’ve selected a desired circuit and I would love feedback from others. I think I will have an input signal drive a high speed comparator which will feed one side of an XOR gate, and then another comparator driven with the 10MHZ signal from the FS. I’ll then throw that up on the analog meter.. the idea is if there is any frequency drift you’ll see the signal increase of decrease with the XOR (phase detector) on the analog meter. Any neat ideas for additional features?

Newly mounted Rubidium Frequency Standard and switching power supply
Newly mounted Rubidium Frequency Standard and switching power supply

WWVB transmitter:

I have a solid transmitter now.. I need to finish the circuit (within Eagle CAD) and send it to the fab. Picking a microcontroller would help too. I like the 18F26K22 but they have a lead time of June @ Digikey. I’m thinking the 18F14K22 will probably work. I don’t need the IO.

 

IBM POS 40 character display:

Well I received this 40 character LCD display (for $9 off eBay) yesterday… Adam Fabio conned me into making the purchase 😉 Yesterday I spent six solid hours of reading and watching my logic analyzer. This display driver has me baffled at what the protocol it wants. I’m sure it’s RS-485, most likely 9600 baud..  and the 87C52 processor has a t2 (timer 2?) output XORing the RS-232 signal after driver/receiver with a 2Hz square wave. That’s odd.. I hung up that project for now.. maybe I’ll get lucky and stumble into a signal protocol description.

PIC Clicker/GPS2 click:

Zero progress from Saturday. I think this will be my next week entertainment while I’m out-of-town. I’ve packed a little electronics-go bag 🙂

Color Synth and Sequencer:

I ordered my spectrum analyzer for filter building. It should be here just into the new week next week which kind of sucks because I’m out-of-town for training. I’m very excited to have a spectrum analyzer. I purchased a bunch of SMA cabling, adapters, made an sample attenuator for it. I almost bought a used one but in the end I just bought new. I’m sure it’ll make it into a few posts.

A long week of mouse hacking and projects

I’ve been a little busy on the workbench lately. I’ve been working late at the-day-job so I’ve been neglecting my workbench notebook and my blog for most of this week. I’ve got a ton of “fun” stuff planned for this weekend; no way I’ll get it all done.

I won’t make you read through the whole post if I pulled you in with mouse hacking 😉

I am a poor gamer.. give me a cheat code and I’ll use it. I have no shame in gaming. Adam Fabio recently got me slightly addicted to ClickingBad … I refuse to link it, don’t search for it.. it’s a god-awful time suck. I clicked a freakn’ mouse for 90 minutes straight… Well screw that. I pulled out one of those el-cheapo USB mice you get with a refurb computer… the $5 throw-away kind. I popped it open and as luck would have it little microswitchs on a single sided PCB. Well 2-1/2 minutes later I had soldered wires to the switch contacts, dumped them on the normal open contacts of a small relay,  hooked it up the relay coil to my MOSFET driver (yes, way overkill, it was laying there already), and threw it under a PIC. I used a rate of 70 ms off 40 ms on.. I probably could have sped that up but it was at that warp speed, I was happy. Did it take away from the game? Nah, I had that much more to buy! I was shocked the relay held out for a few days of being hammered (“Batches hand-cooked: 1.01Q” , that’s not a quadrillion clicks, but it was a lot regardless). I pulled my cheat-clicker off after a while because the super-fast click of the relay was getting pretty damn annoying. I had little bug in the system: a little phantom drift issue with the el-cheapo mouse so turned down pointer sensitivity to as slow as possible; That allowed for a couple hour stretch of non-stop cheating.

Mouse Click Hack

Continuing on with actual electronics projects: I have five active projects I’m working on, a few I’ve recently benched waiting on a big purchase, trying to get other stuff out of the way or for other reasons.

1. Video Synth … Lawrence has inspired me to help him build a Video Synth. I’ve gotten a fair amount of reading done. Looks like I’m going to need a spectrum analyzer for some filters I want to build (awww darn! heh). I’ve gotten some boards finished which I needed for other projects but just happened to work for this one as well.

 

Sweep Generator -- Opps I forgot something
Sweep Generator — Opps I forgot something

… version 2.0 of these boards in at the fab. I’ll probably sell some of these for people needed a quick sweep generator for their VCOs, etc.

 

2. Workshop Time Standard  — Just started this because I got most of the parts in. This will be powered by my MikroElectronika PIC clicker and GPS2 click…. Stay Tuned.

3. WWVB for non-US persons… Edward contacted me about using my WWVB project but to actually broadcast the correct time. Well, fair enough. This has gotten me to buy all the stuff I think I need to create a PIC NTP client, GPS NMEA input .. and then the easy part. Broadcast it on 60KHz… I’ll have some kind of notice you should do this in a lead box under the ocean. I certainly wouldn’t sell this to someone within the US. I don’t think the FCC has any rule that allows a person to broadcast any tiny amount of power on 60KHz, certainly not intentionally. I didn’t find anything I thought I’d be safe under Part 15. I’d love to be proven wrong on this.. really.

4. My electric scooter. I just got a welder … now for some more material. Most of the electronics are done-enough until testing.

5. My ESR meter… waiting on parts of course.. come on Customs.. let me have my fun-stuff.

… all this work has left me bench a disaster zone.

 

The Great Mess of April 2014
The Great Mess of April 2014

 

.. I’ll finally leave you with this fun photo:

Ohm's law
Ohm’s law

TAUTIC’s Internet Connected 8-bit PIC

Jayson Tautic had mentioned, on IRC the other day, a Fourth system with the ability to run on a PIC… that pretty cool (mad scientist stuff!). It prompted me to consider connectivity; I posted my progress on the recent Digi One SP project that came out of that on my last post.

It’s been noticed that Jayson sleeps far fewer hours than I do, this is further proof! At lightning speeds (maybe that’s why he sells a lightning sensor?) he has his Pi running ser2net which connects the internet to a terminal port and from there to the serial port of his PIC running FlashForth. Jayson has Forth running on an 18F14K22 on his 20pin dev board which can also be found on his tindie store. I have never reviewed/commented on someone else’s project but I thought this was extremely clever and demanded attention. He won’t admit it was much of course, he’s far to modest. What’s next? What does this open up for us 8-bit PIC developers? Well I tell you what.. I have some ideas you’ll see in the near future!

 

tautic_ff

RGB LED Break-Out-Board

I had a need for this little break-out-board for a bunch of RGB LEDs I had acquired. Have a need?

A special deal to get rid of the boards and LEDs with “unknown” specs. These LEDs look just like the 60mA LEDs from China but I don’t have any specs on these. I based my design on LEDs I have coming in stock.. well unfortunately these LEDs have the blue and green swapped so I took an exacto-knife to pull of the stencil stating which is R, G and B… I want to get rid of these so I’m going to cut you a deal: what do you get? an extra board and an extra LED! A practice board for reflow! These are full functional parts and pieces. I’ve tested every LED on all boards.

Here is what you’ll receive:

 

RGB LED Special

In the photo you’ll see the arrows. The black arrow represents the negative side of your supply and the colored arrows correspond to the color of the positive (anode) side of each LED.

RGB LED diag

 

In version 1 of this board I’ve added 100 Ohms resistors. These are the values I needed for my project. If you really happen to need other values let me know and I’ll see what I can do. These work fine on 3.3V as well as 5V.

Digi One SP for Micros

Today was a FR4-AIL day, again. Still no PCBs in the mail today; I suspect this will be a PITA because they never left the Oregon post office.

With that I wasn’t really in the mood for any “real” electronics today. Jayson Tautic mentioned he put Fourth on a PIC 18F14K22 which is pretty cool. It got me thinking, one thing and then another and on to connectivity which lead me digging into the old project bins.

I’m sure it’s been done over and over but it hasn’t been done by me; I’ll see if I can put a PIC online. Maybe a simple text game?

Out of the projects bin came a Rev A11 XPort… well an hour later it went right back into the box. I think the old versions weren’t really friendly for what I was thinking.. next attempt was a Digi One SP. I bought one off eBay a while back; I’m way more familiar with these as I had installed a couple of them for a radio station for some telemetry.

EdgePort/i (USB to RS232) to Null Modem Adapter to Digi One SP to ethernet..
EdgePort/i (USB to RS232) to Null Modem Adapter to Digi One SP to ethernet..

The whole set up on the Digi One SP is pretty easy; logon by web browser, set up a static IP, etc, etc… the only tricky part was Serial Port set up. It would seem the Serial Port Profile setup should be to the “Modem In” profile but in fact to initiate a connection from ethernet you need to choose “Modem Out”. No problem..

So this is how I tested the setup:

I used RealTerm to connect to the serial port, it’s ANSI emulation but I used ASCII so I could the control characters. I connected my EdgePort (USB<–>RS232) through a null modem adapter to the DigiOne SP. On the ethernet side I used Putty; with a little poking I connected to the Digi One with “RAW” TCP to port 2001.

Digi One SP Serial Link Test
Digi One SP Serial Link Test

The connection tidbits are done, now I have to order a wireless bridge so I can get an ethernet port down in my bench (all wifi)… in the mean-time I also set up dyndns with my router because we don’t have a static IP address… TBC.

16F1509 Ramp Generator using the internal 5-bit DAC

To be honest, I have never considered using the PIC 16F1509 digital to analog converter before. I was considering integrating a DAC internally or externally to a microcontroller for my brother’s synth project. I started on the microchip site and found a number of smaller PICs, 12F1501.. 16F1503, that had a 5bit DAC. The 16F753 has a 9bit and the 16F17* series has a 8bit DAC. I stuck with the old standby 16F1509 as I needed a serial port for MIDI and I had it sitting on an easy-to-use dev board. I ordered a 16F17* series PIC a while back because they have some interesting peripherals and I will probably build a board around it for the resolution.

Turns out the DAC is probably the easiest peripheral I’ve used on the PIC. It took me longer to wait for the PICKit to update from 18F configuration to 16F. BUT.. if you’re having issues.. here you go:

A simple voltage follower (or however you want to buffer the output) is needed on the DAC output. It’s not designed to drive anything.

voltage_follower

 

Don’t expect screaming speeds out of this thing…it’s just not going to happen. I ran mine up to 1.3KHz, which is more than enough for what I’m trying to accomplish. If you put an A/D converter in you could use that to control your ramp speed and you’d have yourself a nice driver for your VCO input on test equipment with properly conditioned output.

Digital to Analog converter on the PIC 16F1509; The 5bit DAC gives you 32 voltage levels.
Digital to Analog converter on the PIC 16F1509; The 5bit DAC gives you 32 voltage levels.

 

The code:


/*
* File: main.c
* Author: Charles M Douvier
* Contact at: http://iradan.com
*
* Created on April 13, 2014, 1:14 PM
*
* Target Device:
* 16F1509 on Tautic 20 pin dev board
*
* Project: DAC ramp test
*
* Version:
* 1.0
*
*/
#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 
#include 
#include 
#include 

//config bits
#pragma config FOSC=INTOSC, WDTE=OFF, PWRTE=OFF, MCLRE=ON, CP=OFF, BOREN=ON, CLKOUTEN=OFF, IESO=OFF, FCMEN=OFF
#pragma config WRT=OFF, STVREN=OFF, LVP=OFF

#define _XTAL_FREQ 4000000 //defined for delay

int x; //DAC counter

/*
*
*/
void init_io(void) {
TRISAbits.TRISA0 = 0; // output
TRISAbits.TRISA1 = 0; // output
TRISAbits.TRISA2 = 0; // DAC2
TRISAbits.TRISA3 = 0; // output
TRISAbits.TRISA4 = 0; // output
TRISAbits.TRISA5 = 0; // output
// TRISAbits.TRISA6 = 0; // output
// TRISAbits.TRISA7 = 0; // output

ANSELA = 0x00; // all port A pins are digital I/O

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

ANSELB = 0x00; // all port B pins are digital I/O
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
ANSELC = 0x00; // all port B pins are digital I/O
}

void init_dac(void)
{
DACCON0bits.DACPSS = 0; //VDD ref
DACCON0bits.DACOE2 = 1; //output 2 enable (RA2)
DACCON0bits.DACEN = 1; //enable DAC
}

int main(void) {

// set up oscillator control register, using internal OSC at 4MHz.
OSCCONbits.IRCF = 0x0d; //set OSCCON IRCF bits to select OSC frequency 4MHz
OSCCONbits.SCS = 0x02; //set the SCS bits to select internal oscillator block
OPTION_REGbits.nWPUEN = 0; // enable weak pullups (each pin must be enabled individually)

init_io();
init_dac();

x = 0;

while (1) {

for (x = 0; x < 31; ++x)
{ //DAC is 5 bit
DACCON1bits.DACR = x; //dump count into DAC value
__delay_us(25);
}

}
return (EXIT_SUCCESS);
}