0
Offline
Jr. Member
Karma: 0
Posts: 50
Arduino rocks
|
 |
« Reply #15 on: June 16, 2008, 01:15:38 pm » |
Thanks. It works great now.
Phil
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 11
Arduino rocks
|
 |
« Reply #16 on: June 18, 2008, 06:27:20 pm » |
Hey, nice work on the code. What is the name of the gyro that you are trying to interface with the arduino? Could you include your code for the gyro as well? I'm having trouble interfacing the MLX 90609 rate gyro through SPI.
Thanks!!
|
|
|
|
|
Logged
|
|
|
|
|
New Zealand
Offline
Jr. Member
Karma: 0
Posts: 69
arduino: far too much like electrical engineering.
|
 |
« Reply #17 on: June 19, 2008, 01:33:51 am » |
I'm using the sparkfun analogue IMU, hence the ADC. The important thing with SPI is to read the datasheet carefully, nearly all SPI devices aren't 'standard'.
|
|
|
|
|
Logged
|
-- Alec
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 50
Arduino rocks
|
 |
« Reply #18 on: July 01, 2008, 01:30:57 pm » |
Hello Halabut, I recently bought a Wiring Mini board and hooked up one of these mcp3208's to it .. using the same code you provided. It compiled with no errors and successfully uploaded to the wiring board. It doesn't seem to work though. All I see in the serial monitor of the Wiring IDE is either 0 or 4095 ... and the occasional random number every once in a while.
I'm using the same pin #'s ... 10,11,12,13
It works 100% on my arduino.
thanks, Phil
|
|
|
|
|
Logged
|
|
|
|
|
New Zealand
Offline
Jr. Member
Karma: 0
Posts: 69
arduino: far too much like electrical engineering.
|
 |
« Reply #19 on: July 01, 2008, 06:20:42 pm » |
I don't have any experience with wiring, but from the sounds of it this is a hardware problem. Check all your wires are in correctly and that the ADC has its ref voltage and power supplies connected and they're at the right levels. Other than that I can't think what it'd be.
|
|
|
|
|
Logged
|
-- Alec
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 50
Arduino rocks
|
 |
« Reply #20 on: July 01, 2008, 06:33:47 pm » |
Thank you. I checked it a few times over and then switched to a different set of pins with the same results. It is strange. Do you think it has something to do with timing? ... maybe the wiring board's timing is different from the Arduino.
Phil
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
God Member
Karma: 0
Posts: 572
|
 |
« Reply #21 on: July 01, 2008, 06:49:47 pm » |
Maybe the pin mapping is different between wiring an arduino. remember the pin #'s in the arduino world typically refer to the arduino board's pin numbers, not the microcontroller pin numbers.
Arduino was obviously inspired/based on/an offshoot of (not sure of the technical term, don't want to offend the tinket.it guys) the wiring board, so maybe the numbers match, I'm not sure.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 50
Arduino rocks
|
 |
« Reply #22 on: July 01, 2008, 08:23:13 pm » |
That's a good possibility, but I don't think I would have seen anything on the serial monitor.
Phil
|
|
|
|
|
Logged
|
|
|
|
|
New Zealand
Offline
Jr. Member
Karma: 0
Posts: 69
arduino: far too much like electrical engineering.
|
 |
« Reply #23 on: July 02, 2008, 12:05:15 am » |
Timing shouldn't be a problem, the code is all bit-banged. It's very timing insensitive, and doesn't rely on any chip-specific features.
|
|
|
|
|
Logged
|
-- Alec
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 50
Arduino rocks
|
 |
« Reply #24 on: July 02, 2008, 06:07:21 pm » |
I'm pretty sure it is a pin mapping problem. I just checked out the schematic at: http://wiring.org.co/download/WiringMini.pdfIt looks like Port 3 is where I need to be wiring the ADC to ... I was originally trying to use Port 1 on the Wiring Mini Wiring Mini Board pins MCP3208 ADC Pins 24 -----> CS Chip Select Pin 10 25 -----> CLC Clock Pin 13 26 -----> Din MOSI Pin 11 27 -----> Dout MISO Pin 12 Looks like this should work. I'm out on the road with my job right now. I should be able to check this on Monday. Phil
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 50
Arduino rocks
|
 |
« Reply #25 on: July 07, 2008, 04:25:09 pm » |
I've been messing around with it for the last couple hours on the correct pins ... still the same results. I have no idea what may be the problem.
Phil
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 50
Arduino rocks
|
 |
« Reply #26 on: July 08, 2008, 09:36:48 am » |
I'm back to just using this on Arduino.
I'm trying to use the AGND pin. I tried putting about 2V on it, but it just shunts down to millivolts ... since it is an analog ground. Is AGND really meant for setting a lower limit? The spec sheet doesn't really mention too much about it.
Phil
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 50
Arduino rocks
|
 |
« Reply #27 on: July 08, 2008, 11:04:34 am » |
I figured it out. I had to use a separate power source for the analog end of things. I connected the pot wiper (from analog source) to AGND pin.
In the end it brings the resolution down to only 11 bits instead of 12. I have my Vref set to 4.77V (from digital source) and AGND of 2.25V .... my ADC range is from 0 to 2047. Is there any way to make this range from 0 to 4095 ?
P.S. I didn't connect the Analog ground to the digital ground.
Phil
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 3
Arduino rocks
|
 |
« Reply #28 on: October 27, 2009, 09:08:25 am » |
Hi halabut, I am a newbie with arduino. I'm currently trying to implement ADC MCP3204. I tried to use your code and connect similarly but my adcvalue keeps reading either zero or 4095 (5V). I suspect it's the timing but the datasheet for both 3204 and 3208 have the exact same timing. Please help, thanks!
|
|
|
|
|
Logged
|
|
|
|
|
New Zealand
Offline
Jr. Member
Karma: 0
Posts: 69
arduino: far too much like electrical engineering.
|
 |
« Reply #29 on: October 27, 2009, 04:51:34 pm » |
That's strange, especially given that they're the same datasheet. Looking at the code it should work fine (for the first four channels only obviously) All I can advise is checking your connections against the datasheet, the pins are in the same order (except dgnd on the left). Many of my frustrating 'broken' circuits have been me forgetting to connect ground, so check everything twice. Other than that it might (and this is unlikely) be a dud chip.
Alec
|
|
|
|
|
Logged
|
-- Alec
|
|
|
|
|