Show Posts
Pages: 1 ... 21 22 [23] 24 25
331  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.
332  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.
333  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.
334  Forum 2005-2010 (read only) / Interfacing / Re: detecting obstructions on the sea on: December 08, 2010, 09:10:03 pm
335  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.
336  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.
337  Forum 2005-2010 (read only) / Interfacing / Re: detecting obstructions on the sea on: December 08, 2010, 10:05:47 am

I have to stop getting sidetracked as well!
Said $20 rover now has GPS and an HMC6352 digital compass.
When I do have spare time I've been working on getting the thing to travel between 2 GPS way points.
Ultimately I want all this in my UAV, I figure a slow moving ground vehicle is a much more "forgiving" environment than a 'plane in the air.

The other, but related project is a GPS/navigator/"tricorder" thing.

One thing I should warn you, if you are going to do much work with ultrasonics, you ARE going to need a decent CRO.
Working with op-amps without a CRO is just plain frustrating, especially if you are using a single rail supply for op-amps like the TL081.
Not only that but just "keying" your ultrasonic transmitter and watching the return echoes on the CRO will give you all kinds of ideas on how to process the data.
The amount of detail you can see on the CRO screen will amaze you.
Just get you Arduino to send regular pings and watch the returns.

Also don't overlook doing stuff in analog with op-amps, THEN digitising the signals.
For ultrasonic receivers don't mess about with instrumentation amps like 741's, LM3900's and the like, you need to use a JFET op-amp that has a high input impedance and low noise.
I use TL081's or NE5534's, these are single amp/package devices.
The 2 and 4 amp versions, the TL082 and TL084 are ok, but you will get cross talk @40Khz.
That's why I said to use 2 stages of X10 gain, you get WAY less noise than a single stage of x100 gain.
338  Forum 2005-2010 (read only) / Interfacing / Re: detecting obstructions on the sea on: December 08, 2010, 09:13:17 am
I started out using an LM386 @12V, then went to 2 LM380's in bridge configuration.
The receivers have 2 TL081 JFET op-amps, each with a gain of 10.

Originally I was using my SYM-1 (that's a 6502 single board computer with 32K of RAM, running @ 1Mhz) to process the data, using 3 ADC0804's.
That was kinda "iffy", so I gave each A/D converter it's own 2K static CMOS RAM, with a counter stepping @ 10khz, which is the max sampling rate of the ADC0804.
That only gives you a minimum of 1 foot/sample, as sound travels @1ms/foot.
I then went to TL0831 ADC's, those are 8 bit serial converters that let you clock data @600K, I divided the 6502's 1Mhz clock by 2, to give me a 500khz clock, which gives 62.5ksample/sec.
Thats a minimum range of around 5mm! Which was too tall an ask for a 1Mhz processor.
So I started using the same 40khz clock I was using to drive the ultrasonic transducer, which gives you a minimum resolution of 6cm, which was still pushing the envelope for a single 6502.
I started using the SYM simply to control the sonar, then passed the data on to an Apple II, that was kinda slow as well, but a friend gave me my first Linux system, a DX-4/100 and I transferred all my Pascal code over to the Linux box.
That's as far as I got until a couple of months ago when I got my first Mega.
As I said first thing I did was put a Mega on a $20 radio controlled car, with a Pololu H-Bridge module and an XBee module.
I'm using the first 3 analog inputs on the car's Mega for the 3 ultrasonic receivers.

My second Mega is receiving the data and I'm displaying it either on my eee or my desktop machine, just as simple vertical bar graphs.

It's all pretty crude right now, but when work calms down a bit I'll refine the circuit and code.

I'll draw up the circuit if you want and post it.

There is not much to it, just the LM380's driving the transmitter, I got the circuit straight from the National Semiconductor application note.
The receivers are just 2 JFET op amps each with a gain of 10.

Even if you want to use normal ranging you can still use the same setup.

I should mention I really like building big, complex circuits out of 7400 series chips, normal 74LS series can clock at a maximum of 25Mhz, which was pretty darn fast when I only had access to 1Mhz processors.
The craziest/most complex thing I ever built was a "Life" engine, that could do 25 generations/second.

So if this idea for "sonar illumination" sounds complex that's why.
Using a modern microcontroller will make it a lot simpler, even if you need to add external RAM as a buffer.
Besides if bats can do it, so can we!
339  Forum 2005-2010 (read only) / Interfacing / Re: detecting obstructions on the sea on: December 08, 2010, 01:48:06 am
If you use one of the waterproof ultrasonic receiver/transmitter pairs and really drive the transmitter, by that I mean don't mess around with 5V, use an amplifier chip, 2 LM380's in a bridge configuration or an STK module.
Those sealed ultrasonic transmitters will produce a >105dB and take a maximum input voltage of 140V!
That is enough to hurt, so don't put your ears anywhere near it when it's operating, you wont hear it, but believe me you will feel it, like somebody sticking a knitting needle in your ear.
Here in Australia you can buy a kangaroo scaring device that mounts on your front car bumper, I've seen 'roo's react to them at distances of over 100M! Again it's not something you can safely stick your ear in front of, it really hurts!
Same goes for ultrasonic "intruder" detectors, some of those have a VERY high output.

Bat's, rat's dolphin's and whales have been "imaging" like this for ever!
Dolphin's can stun fish with a concentrated pulse of sound.

I've been experimenting with a continuous output ultrasonic system.
Rather than a pulse I've been trying to "illuminate" the area in front of a small rover, then using multiple receivers to "watch" the reflected sound.
With 3 receivers I "fill" in the gaps between them by summing the outputs of the outer receivers with the centre one, sort of like synthetic aperture radar.
I started out just watching the output on my CRO, as soon as I got my Mega and XBee modules I started visualising the A/D converters output as simple vertical bar graphs.
You can drive around quite well without running into stuff.

Another thing I've tried is a few different shaped "reflectors" for the transmitter and receivers.
A simple plate at 45 degrees above a horizontally mounted transmitter widens the field of the beam produced, as well as flattening it out.
Building small horns for the receivers also is something to try.

You can definitely tell the difference between various materials and textures, grass has a different texture to gravel, bark and wood return a different sound texture to concrete, which is different to bricks.

340  Forum 2005-2010 (read only) / Interfacing / Re: Temperature, Humidity, and Pressure Data logger on: December 08, 2010, 09:12:21 pm
For a temperature, humidity and water flow logging and warning system I'm putting together for the turkey farm I work on, I'm going to use the Seeedstudio Mega clone, it's like half the price and brings all the 1280's I/O pins.
341  Forum 2005-2010 (read only) / Interfacing / Re: Temperature, Humidity, and Pressure Data logger on: December 08, 2010, 12:51:30 am
I have yet to get an SD card to work with a simple voltage divider to shift levels.

But, on the GPS/Navigator/environmental monitor thing I'm building I have -
On I2C
- An HMC6352 digital compass
- A DS1307 RTC
- 8 24LC256 EEPROMS

- An MPL115A Digital barometer.
- A uM-FPU v3 floating point unit

On the Mega's UARTS

- Serial "0" is for programming and uploading collected data
- Serial 1 is connected to an EM-406 GPS
- Serial 2 is connected to an XBee module
- Serial 3 is connected to one of the "huge" LCD displays with serial backpack that Sparkfun sell

Everything is working fine, except the "keypad" library seems a bit sluggish, I'm going to solve that by adding a separate ATmega328 for the keypad, beeper/key "click", status LEDs.

I've tried all 10 I2C devices on my Duemilenove and it worked fine.
Then I added the 2 SPI devices and it still worked.
I just ran out of I/O pins for everything else!
I2C is a fairly fast serial protocol and SPI is way faster.

If it were me, I'd use a Mega, just for the extra UART's and I/O.
342  Forum 2005-2010 (read only) / Interfacing / Re: Driving a speaker, where's the volume? on: December 07, 2010, 07:21:01 pm
Great! That's exactly what I meant, even if I didn't articulate it very well.
Your speaker will last longer this way.
343  Forum 2005-2010 (read only) / Interfacing / Re: Driving a speaker, where's the volume? on: November 28, 2010, 03:40:15 am
I would use an LM386, if you look at the circuit in application note, there is a capacitor in series with the speaker.

The "cap" is NOT just for filtering, not only does it stop DC bias from destroying your speaker, but stores a bit of energy.

You'll need to put a 10k pot in series between the Arduino pin and the input of the LM386.
If you build the basic '386 circuit, it'll have a gain of 20, with a digital out put into an 8 ohm speaker it'll be pretty loud!

The reason you are getting less volume than you are expecting is that electromechanical speakers do not have the same characteristics as a piezio-electric speaker.
Because it has a coil AND a magnet there is inductance and reluctance to take into account.
The transistor circuit will work a whole lot better if you put an electrolytic cap in series with the speaker, say 250 uf, with the positive side of the cap going to your transistor amp, the negative side to the speaker, the other side of the speaker should go to ground.

Driving it the way you are will burn out the voice coil.
344  Forum 2005-2010 (read only) / Interfacing / Re: i2c crash with 10k [ch937] pullups.. ok with 2.2K [ch937]. ??? on: December 06, 2010, 06:39:05 pm
You should have a 100nf ceramic or greencap on both the input and out put, as well as the 10uf tantalum or electrolytic cap on the output, other wise the regulator will oscillate like a bitch!

Also remember with linear regulators like the LD1117S33CTR, you need to give it enough voltage to "work" with or it will oscillate like a bitch!
345  Forum 2005-2010 (read only) / Interfacing / Re: Melexis SMBus IR Thermometer - NFI on: December 01, 2010, 09:46:20 am
I tried the 4.7K pull up resistors, but that didn't work.
There is another document on the Melexis site, I'll post the address later, it has "preliminary" stamped all over it, but it does look hopeful.
I'm going to have another go at it when I get my Tektronics storage CRO home, I think I'll have more luck.

On thing to bare in mind is SparkFun has an evaluation board for the MLX90614

If you have a look at the schematic

They have just hooked the sensor up to the I2C port, no pull ups!

Unfortunately the link on github is broken, so I've not been able to download their source.

Has anyone found out why using the i2cmaster library prevents the UART working?
As a few people have pointed out, even a simple "Hello World" no longer works on the serial monitor!

The PWM output is going to be a "chicken and egg" problem, you'll have to make it work over I2C to set it up!

As I'm going to use this sensor in my "tricorder" thing, I was going to mount it in a "wand", along with some gas sensors.
My idea is to use a separate ATMEGA in the wand and communicate back to the main unit via serial link.

I already have 10 devices on my I2C bus, an HMC6352 digital compass, a DS1307 RTC and 8 24LC256 EEPROMS, I'll also have a temperature and humidity sensor when it arrives, that'll make 11, 12 if I put my uM-FPU V3 on the I2C bus, but I think I'll keep that on the SPI bus along with my MPL115A.

From what I've read SMB and I2C devices are going to be "difficult" to have on the same bus.
So a dedicated controller in the "wand" seems like a good idea.
I've already ordered a few ATmega328's pre-programmed with the Arduino bootloader, I've found the keypad library a bit "twitchy" when you have a lot of stuff going on.
So I was going give my keypad it's own controller to scan the keys, make the key press "beep" and do some other stuff.

This project is taking on a life of it's own!
I'll have to start documenting it now it has the beginnings of a case.
And before you ask, yes, my Mega still has a few port pins I'm not using, yet.
Pages: 1 ... 21 22 [23] 24 25