Show Posts
Pages: 1 ... 22 23 [24] 25 26 27
346  Forum 2005-2010 (read only) / Interfacing / Re: VHS Data storage on: January 23, 2011, 05:24:11 am
I used to back up harddrives, 5M, back in my Apple 2 days.
The thing that will be hardest to overcome is your common or garden variety VHS deck is pretty sloppy timing wise.
The horizontal lock on ananlog TV is pretty tolerant of these variations, but the Corvus harddrive backup unit had real problems coping.
We ended up having to buy studio or broadcast quality decks for our customers.

When Sony first released the F1 PCM recorder that was a companion unit to their first model of CD player, you had to use a particular model of VCR.
It was all interconected by incredibly expensive 100 way cables.

Each line of video is 63.5 uS, followed by an 8 uS horizontal sync pulse.
There are 2 fields of 312.5 lines, at the end of each field is an 11uS verticle sync pulse.
Then a 22 uS vertical retrace period.

If you only stored say, 100 bytes/line, which would give you about 3k bytes/field.
With a 15625kHz line rate, @100 byte/line, you'd have to clock data out @1562.5kHz.
Straight up it would need a Mega, just for the buffer.

At the end of the day it seems like a lot  of hassle just for the intelectual exercise!

You could go really retro and build an audio cassette interface!
It would be a lot less hassle and you could use it for other things, like a laser data link or go nuts and communicate between two Arduinos with tin cans connected by taught string.
Which I have done! It was pretty funny!
347  Forum 2005-2010 (read only) / Interfacing / Re: MPL115A1 reading consistantly low on: January 23, 2011, 04:53:43 am
My temperature readings were consistantly 12C low.
This was why I was going to try readings from another temperature sensor.
As for the barometric pressure reading I'm still not sure.
I was going to try getting an aneroid barometer or 250ml of mercury and build "wet" barometer or manometer.

348  Forum 2005-2010 (read only) / Interfacing / Re: MPL115A1 reading consistantly low on: January 21, 2011, 07:13:30 am
There is an automated weather station about 15km from here that is about the same elevation as I am.
When I've looked at the current barometer reading it seems to be very close to what my MPL115A1 is measuring.
Likewise the altitude is pretty close to what my EM-406 GPS module and the topographic map says my elevation is.
I recently bought a Sparkfun TMP-102 and SHT15 modules and I was going to try using the temperature reading from that to see if it made a difference to the barometric pressure reading.
I'm not sure if this is the right way to go, but more data can only be a good thing.
349  Forum 2005-2010 (read only) / Interfacing / Re: MPL115A1 reading consistantly low on: November 27, 2010, 12:25:21 am
Ok, I've only just started using the Arduino platform, but seriously how many ways are there to hook up an SPI device?

Am I missing something?

MPL115A1 is a very specific part, the example code was to big to post here, the algorithm to extract the corrected pressure reading is also very specific.
Unless you have an MPL115A1 there is no way you would need to wade through the Freescale data sheet.

Here are the pin connections for a Mega, plus the register defs.
This come straight from the example sketch on the SparkFun sit, modified for the Arduino Mega.

MPL115A1 Breakout ------------- Arduino Mega
 -----------------               -------
         SDN ------------------- D49
         CSN ------------------- D53
         SDO ------------------- D50 *
         SDI ------------------- D51 *
         SCK ------------------- D52 *
         GND ------------------- GND
         VDD ------------------- VCC +
         * These pins physically connect to the SPI device so you can't change them
         + 5V board use 5V VDD, 3.3V board use 3.3V VDD
 License: CCAv3.0 Attribution-ShareAlike (
 You're free to use this code for any venture, but I'd love to hear about what you do with it,
 and any awesome changes you make to it. Attribution is greatly appreciated.

// Includes
#include <SPI.h>

// Get your current altimiter setting from from the National
// Weather Service -
// This value is often labeled "Barometer" or "Barometric Pressure" or just "Pressure"
#define NWS_BARO 30.04

// Pin definitions
#define MPL115A1_ENABLE_PIN 49
#define MPL115A1_SELECT_PIN 53

// Masks for MPL115A1 SPI i/o
#define MPL115A1_READ_MASK  0x80
#define MPL115A1_WRITE_MASK 0x7F

// MPL115A1 register address map
#define PRESH   0x00    // 80
#define PRESL   0x02    // 82
#define TEMPH   0x04    // 84
#define TEMPL   0x06    // 86

#define A0MSB   0x08    // 88
#define A0LSB   0x0A    // 8A
#define B1MSB   0x0C    // 8C
#define B1LSB   0x0E    // 8E
#define B2MSB   0x10    // 90
#define B2LSB   0x12    // 92
#define C12MSB  0x14    // 94
#define C12LSB  0x16    // 96
#define C11MSB  0x18    // 98
#define C11LSB  0x1A    // 9A
#define C22MSB  0x1C    // 9C
#define C22LSB  0x1E    // 9E

Here is the temperature calculation

float calculateTemperatureC() {
    unsigned int uiTadc;
    unsigned char uiTH, uiTL;
    unsigned int temperature_counts = 0;
    writeRegister(0x22, 0x00);  // Start temperature conversion
    delay(2);                   // Max wait time is 0.7ms, typ 0.6ms
    // Read pressure
    uiTH = readRegister(TEMPH);
    uiTL = readRegister(TEMPL);
    uiTadc = (unsigned int) uiTH << 8;
    uiTadc += (unsigned int) uiTL & 0x00FF;
    // Temperature is a 10bit value
    uiTadc = uiTadc >> 6;
    // -5.35 counts per °C, 472 counts is 25°C
    return 25 + (uiTadc - 472) / -5.35;

And the pressure calculation, this is the heavy bit!

float calculatePressurekPa() {
    // See Freescale document AN3785 for detailed explanation
    // of this implementation.
    signed char sia0MSB, sia0LSB;
    signed char sib1MSB, sib1LSB;
    signed char sib2MSB, sib2LSB;
    signed char sic12MSB, sic12LSB;
    signed char sic11MSB, sic11LSB;
    signed char sic22MSB, sic22LSB;
    signed int sia0, sib1, sib2, sic12, sic11, sic22, siPcomp;
    float decPcomp;
    signed long lt1, lt2, lt3, si_c11x1, si_a11, si_c12x2;
    signed long si_a1, si_c22x2, si_a2, si_a1x1, si_y1, si_a2x2;
    unsigned int uiPadc, uiTadc;
    unsigned char uiPH, uiPL, uiTH, uiTL;
    writeRegister(0x24, 0x00);      // Start Both Conversions
    //writeRegister(0x20, 0x00);    // Start Pressure Conversion
    //writeRegister(0x22, 0x00);    // Start temperature conversion
    delay(2);                       // Max wait time is 1ms, typ 0.8ms
    // Read pressure
    uiPH = readRegister(PRESH);
    uiPL = readRegister(PRESL);
    uiTH = readRegister(TEMPH);
    uiTL = readRegister(TEMPL);
    uiPadc = (unsigned int) uiPH << 8;
    uiPadc += (unsigned int) uiPL & 0x00FF;
    uiTadc = (unsigned int) uiTH << 8;
    uiTadc += (unsigned int) uiTL & 0x00FF;
    // Placing Coefficients into 16-bit Variables
    // a0
    sia0MSB = readRegister(A0MSB);
    sia0LSB = readRegister(A0LSB);
    sia0 = (signed int) sia0MSB << 8;
    sia0 += (signed int) sia0LSB & 0x00FF;
    // b1
    sib1MSB = readRegister(B1MSB);
    sib1LSB = readRegister(B1LSB);
    sib1 = (signed int) sib1MSB << 8;
    sib1 += (signed int) sib1LSB & 0x00FF;
    // b2
    sib2MSB = readRegister(B2MSB);
    sib2LSB = readRegister(B2LSB);
    sib2 = (signed int) sib2MSB << 8;
    sib2 += (signed int) sib2LSB & 0x00FF;
    // c12
    sic12MSB = readRegister(C12MSB);
    sic12LSB = readRegister(C12LSB);
    sic12 = (signed int) sic12MSB << 8;
    sic12 += (signed int) sic12LSB & 0x00FF;
    // c11
    sic11MSB = readRegister(C11MSB);
    sic11LSB = readRegister(C11LSB);
    sic11 = (signed int) sic11MSB << 8;
    sic11 += (signed int) sic11LSB & 0x00FF;
    // c22
    sic22MSB = readRegister(C22MSB);
    sic22LSB = readRegister(C22LSB);
    sic22 = (signed int) sic22MSB << 8;
    sic22 += (signed int) sic22LSB & 0x00FF;
    // Coefficient 9 equation compensation
    uiPadc = uiPadc >> 6;
    uiTadc = uiTadc >> 6;
    // Step 1 c11x1 = c11 * Padc
    lt1 = (signed long) sic11;
    lt2 = (signed long) uiPadc;
    lt3 = lt1*lt2;
    si_c11x1 = (signed long) lt3;
    // Step 2 a11 = b1 + c11x1
    lt1 = ((signed long)sib1)<<14;
    lt2 = (signed long) si_c11x1;
    lt3 = lt1 + lt2;
    si_a11 = (signed long)(lt3>>14);
    // Step 3 c12x2 = c12 * Tadc
    lt1 = (signed long) sic12;
    lt2 = (signed long) uiTadc;
    lt3 = lt1*lt2;
    si_c12x2 = (signed long)lt3;
    // Step 4 a1 = a11 + c12x2
    lt1 = ((signed long)si_a11<<11);
    lt2 = (signed long)si_c12x2;
    lt3 = lt1 + lt2;
    si_a1 = (signed long) lt3>>11;
    // Step 5 c22x2 = c22*Tadc
    lt1 = (signed long)sic22;
    lt2 = (signed long)uiTadc;
    lt3 = lt1 * lt2;
    si_c22x2 = (signed long)(lt3);
    // Step 6 a2 = b2 + c22x2
    lt1 = ((signed long)sib2<<15);
    lt2 = ((signed long)si_c22x2>1);
    lt3 = lt1+lt2;
    si_a2 = ((signed long)lt3>>16);
    // Step 7 a1x1 = a1 * Padc
    lt1 = (signed long)si_a1;
    lt2 = (signed long)uiPadc;
    lt3 = lt1*lt2;
    si_a1x1 = (signed long)(lt3);
    // Step 8 y1 = a0 + a1x1
    lt1 = ((signed long)sia0<<10);
    lt2 = (signed long)si_a1x1;
    lt3 = lt1+lt2;
    si_y1 = ((signed long)lt3>>10);
    // Step 9 a2x2 = a2 * Tadc
    lt1 = (signed long)si_a2;
    lt2 = (signed long)uiTadc;
    lt3 = lt1*lt2;
    si_a2x2 = (signed long)(lt3);
    // Step 10 pComp = y1 + a2x2
    lt1 = ((signed long)si_y1<<10);
    lt2 = (signed long)si_a2x2;
    lt3 = lt1+lt2;
    // Fixed point result with rounding
    //siPcomp = ((signed int)lt3>>13);
    siPcomp = lt3/8192;
    // decPcomp is defined as a floating point number
    // Conversion to decimal value from 1023 ADC count value
    // ADC counts are 0 to 1023, pressure is 50 to 115kPa respectively
    decPcomp = ((65.0/1023.0)*siPcomp)+50;
    return decPcomp;

I was NOT sniping, I was objecting to the tone.
This is not a syntax or basic electronics question, it IS very specific to this chip.
I was previously not aware there was a "drill" here.
I apologise for any offence
350  Forum 2005-2010 (read only) / Interfacing / Re: MPL115A1 reading consistantly low on: November 26, 2010, 08:14:41 pm
Here is the link to the Sparkfun page.

And the revalent Freescale doc

Here is a link to the example code, it seems there is a limit to mow big a sketch we can post

I'm using the SPI version of this device on a Mega.

So again, has anyone else tried using this sensor on a Sparkfun breakout board.

And PaulS, please, if you don't know what I'm talking about, don't reply.
It was a fairly specific question about a specific sensor.
Anyone who has used it would recognise the the part number, even if you don't.
As to my 16 posts, the replies, besides yours have been really helpful.
Although I will give you credit for questioning why I was trying to use software serial on a Mega, my latest creation is using all 4 UARTS and they work very well indeed.
351  Forum 2005-2010 (read only) / Interfacing / MPL115A1 reading consistantly low on: November 26, 2010, 10:20:55 am
One of the sensors I'm using in my tricorder/navigator/environmental monitor/dog tracker thingy is a MPL115A1 Sparkfun break out.

I'm using the example code, I've checked out the Freescale data sheet and I'm pretty sure the example code implements the hideously complicated calculation to read the temperature and barometric pressure.

But it is reading at least 10C low on temperature and about 100 KPa low on the pressure sensor.
Has anyone else used this sensor?

One thing I can think of is round off error, converting between fixed point math and floating point might explain this.
What do you guys think?
352  Forum 2005-2010 (read only) / Interfacing / Re: Hyundai HG12602NG LCD display - HELP!!!! on: January 15, 2011, 06:07:00 pm
if its a mystery module you may just have to take a chance.

Yeah, I've been thinking that!
From looking at the board I've been able to identify the power anf ground pins.
So far it does look like the HG12605NG data sheet is close, if not the same.
353  Forum 2005-2010 (read only) / Interfacing / Hyundai HG12602NG LCD display - HELP!!!! on: January 13, 2011, 09:31:47 pm
I was buying components the other day and right next to the cash register there were a stack of these great looking LCD modules and they were only AUS$10!.
As I was on one of my spending spree's I grabbed a couple.
It's 128x64, blue on white, 95mmx70mm, and I can't find a data sheet for it!
Closest I got was HG12605NG, it kinda looks the same, but I don't want to damage the module.
As far as I can tell the controller is a S1D13700.
Is this controller compatible with the KS0107B/KS0108B library?
I really need to get this barn data logger and alarm system running, like a week ago.
354  Forum 2005-2010 (read only) / Interfacing / Re: How to use the whole 8 bits of a port? on: December 09, 2010, 05:02:52 pm
Thanks Lefty!
The Arduino documentation needs a little beefing up!
I thought I'd seen some reference to what I was trying to do!
I keep looking at the 1280 data sheet and thinking, "How do I do that in a high level language?"

I guess I've spent too much time coding in mnemonics!  smiley

In case you're wondering I have a few "rails" of 32K static CMOS RAM, like a few meg worth and a whole bunch of 6545 and 6845 CRTC display chips.
I just got a TellyMate shield and thought I'd have a crack at designing a graphics shield, say 280x191x8 colours, Apple II hi-res or maybe even 320x200x256 colours CGA resolution.

Castle Arduinostien!

(insert evil laugh here!) smiley-wink

Just for the record, is there any way to have inline machine code or assembler in a sketch?
355  Forum 2005-2010 (read only) / Interfacing / How to use the whole 8 bits of a port? on: December 09, 2010, 10:54:17 am
I've been pouring over the Arduino documentation trying to figure out how to use a whole port on my Mega.
The 2 examples I have in mind are -

- writing to 2 8 bit D to A converters that drive my laser X/Y scanner or CRO for debugging, I'll need to use a couple of other pins for latching the data and controlling the "Z" axis.

- using 2 ports to supply a 16 bit address to static CMOS RAM, then another 8 bits to read/write data, obviously the R/W and CS will have to come from a third port.

Can you actually do this in the Arduino environment or do I need  to go to assembler?

I was looking at the Atmel site just then and was left wondering which version of AVRStudio I need to download.
356  Forum 2005-2010 (read only) / Interfacing / Re: Bit Banging with a pair of photoresistors (LDR's) on: December 09, 2010, 04:51:21 pm
No problem!
The circuit for combining clock and data is pretty simple, just a few nand gates and a shift register from memory, the receiver is as easy with only a 74LS121 mono-stable and a few nand gates, 74LS00's and a shift register.

It's less involved than building a UART from scratch, which isn't that had.
If you embed the clock with the data, you don't have to worry about the 1 1/2 stop bits of asynchronous serial.
357  Forum 2005-2010 (read only) / Interfacing / Re: Bit Banging with a pair of photoresistors (LDR's) on: December 09, 2010, 11:13:20 am
I would suggest you investigate Bi-phase data modulation/demodulation.
In short it's away to combine both data and clock into a single signal.
It's the way pretty much every computer used to read and write data to cassette tape.
The other conspicuous example is ADB or Apple Desktop Bus on Macintosh machines with ADB.
I've got a few circuits in some old issues of Byte magazine around here somewhere I could dig up.
On Mac's with ADB they used T2 on the 6522 VIA chip to generate the timing.

Here is the Rockwell example from way back when

Also the other example is the way Apple II's implemented "soft sectoring" on 5 1/4" floppy disks.

If there is programming getting done @25 or 30 fps on a TV this would be the most obvious way to do it.
358  Forum 2005-2010 (read only) / Interfacing / Re: detecting obstructions on the sea on: December 08, 2010, 09:10:03 pm
359  Forum 2005-2010 (read only) / Interfacing / Re: detecting obstructions on the sea on: December 08, 2010, 08:24:23 pm
The 6502 was the first REAL RISC!
Only 157 instructions!
Z80 twits used to brag about how many registers they had, oh, and that damn block copy!
6502 had so many different ways to do indirect and indexed addressing, it made it hard to port code to anything other than 6809 or 68000!

What's this programming in assembler?! I used to hand assemble!
Still do! (I like to suffer)
My first contact with the Atmel processors was hand assembled code on the AT90S8535.
360  Forum 2005-2010 (read only) / Interfacing / Re: detecting obstructions on the sea on: December 08, 2010, 11:04:35 am
I bought a Micromega uM-FPU-V3, not only does it handle NMEA sentance parsing, but the Micromega site has a whole bunch of application notes about stuff like bearing and distance between 2 waypoints.
The chip was cheap and it's really fun to play with, not only that but there is a whole uM-FPU library for the Arduino.
You should grab one from Sparkfun or where ever and have a play with it.
Pages: 1 ... 22 23 [24] 25 26 27