![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
I got my DE-ACCM3D accelerometer and have it wired up to the Junebug. Junebug is reading AN1, AN2 and AN3 and spitting out numbers to the UART tool. I have the 18F1320's AD in 8-bit mode, dropping the bottom 2 bits and am getting numbers in the range of approximately 68 to 103 decimal on each axis (1g gravity - I'm just tilting it). The actual voltages output by the accelerometer would be approximately 1.33V to 1.99V.
Now my newb question: I have the 18F1320 set to use the internal AVDD (5V) for a reference. If I set it for External VREF+ and feed RA3 with 3.3V from the regulator on the accelerometer, will I get a wider range of values in ADRESH? Or in other words, will I get better sensitivity? Should I switch to 10-bit and rewrite my software? This photo is slightly out of date. Had to add a power supply to the breadboard as the Junebug/PICkit2 can't supply VDD and do UART tool at the same time. accel005sm.jpg
__________________
========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 4th May 2008 at 12:34 AM. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
Some calculations that may help: 5Vref, 10bit Val1= [1.33/5] * 1023 = 272 Val2= [1.99/5] *1023 = 407 5Vref, 8bit Val1a= [1.33/5]*255= 67 Val2a=[1.99/5] * 255 =101 2.5Vref, 10bit Val1=[1.33/2.5]*1023 = 544 Val2=[1.99/2.5]*1023 = 814 2.5Vref, 8bit Val1a=[1.33/2.5]*255 = 135 Val2a=[1.99/2.5]*255 = 202 Ideally to increase the resolution to cover the span and offset of the accelerometer you need a OPA with Offset. Hope this helps.
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
||
|
|
|
|
|
(permalink) |
|
hi futz,
This is a simple instrumentation amp with offset, I designed for use with a altimeter. The principle is the same for accelerometer, it would require a lower setting for the Offset voltage and a tweak to the Gain. The Acc 1.33V to 1.99V would be offset to 0v thru +5V, giving an ADC value of 255 or 1023 max, depending upon the justification of the ADC value. Do you follow OK.?
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ Last edited by ericgibbs; 7th July 2008 at 11:23 AM. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
I did some reading of the datasheet too, and calculated that at -3g the output voltage will be .66V and at 3g it will be 2.66V (it's a 3g accelerometer). It's already op amp buffered - not just a bare accelerometer chip. It looks to me like just doing a 3.3V ref voltage will give me the kind of results I want without extra circuitry. So at 3.3V VREF+ I should see approximately: -3g = .66V = 51 -1g = 1.33V = 103 0g = 1.66V = 128 1g = 1.99V = 154 3g = 2.66V = 206 I'll try it today and see. The DE-ACCM3D datasheet.
__________________
========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 3rd May 2008 at 10:20 PM. |
||
|
|
|
|
|
(permalink) |
|
Hey Blueroom Bill! If you're reading this thread, why does AN4 have a pullup?
I moved my Z axis to AN4 (so I could feed AN3 with a 3.3V reference) and it won't work. I'm pretty sure it's because of that pullup. The accelerometer is fine and the cable is fine. I moved wires around to test all that. Anyway, giving the AD a 3.3V reference worked as I predicted. Full range (-3g to +3g) gives me a ADRESH value swing from approx 51 to 206. Quite useable.
__________________
========================= Futz's Microcontrollers & Robotics ========================= |
|
|
|
|
|
|
(permalink) |
|
AN4 has a pullup for 1wire stuff, also on older PICs including the 18F1320 RA4 is an open collector output.
I did design the Junebug with +VREF as one of the experiments (using VR2) and VR1. You could move the Z axis to RB3 (yes it's analog) or RB4 (the RX pin). Use a software UART on TX. Just my 2c I always enjoy your Junebug articles and photos futz. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
What I'm moving gradually toward is a balancing robot, so I'll really only need one axis. I know everyone says you can't do it without a gyro because the oscillations feed back and the thing falls down, but I'm going to try anyway. I can't believe you can't write some smart software that compensates and damps things. Any robot I build will be very unlikely to be carrying my Junebug anyway. I'd probably either build a pic-proto type board for it or just use a solderless breadboard for easy changes. And I think that proper accelerometer location on the bot could go a long way towards making it more stable. I figure that if I locate it at the "CG", or midpoint, the accel won't feel the g-forces as much and won't oscillate so hard. Watch me be dead wrong. And if I fail I'll learn something anyway, and I'll have the chassis all ready to add a gyro onto.
__________________
========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 4th May 2008 at 01:18 AM. |
||
|
|
|
|
|
(permalink) |
|
Balancing robots are cool.
http://www.geology.smu.edu/~dpa-www/robo/nbot/ I've seen one using a Sharp IR sensor to balance, can't recall the link though. Would be a fun mod for the Mongoose. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
I've seen quite a few that use IR sensors, and a few that use ultrasonic (sonar). They're not as smooth and nice as gyro/accel types though. Even simpler are the ones that use a pot and floor sensor whisker, but they need smooth floors to run on.
__________________
========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 5th May 2008 at 04:57 AM. |
||
|
|
|
|
|
(permalink) |
|
In 2006 Scientific American had an interesting article on ball bots. They sort of looked like giant roll on deorderants.
EDIT: Found the article online. http://www.cs.virginia.edu/~robins/Ballbots.pdf
__________________
search engine for electronic partsJunebug USB PIC programmer kit., USB Bit Wacker, Homepage The 15 Minute Printed Circuit Board! (+drill time) Last edited by 3v0; 4th May 2008 at 01:41 AM. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
I guess you'd need another set of horizontal "arms" to steer with. Here are two: http://www.youtube.com/watch?v=OnRV-ggJmQ4 http://www.youtube.com/watch?v=IlMMWFwHti4 Here's the BallBot. Pretty cool machine: http://www.youtube.com/watch?v=5le0t...eature=related
__________________
========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 5th May 2008 at 11:14 PM. |
||
|
|
|
|
|
(permalink) |
|
If anyone is interested, photos, movies and source code have been published.
__________________
========================= Futz's Microcontrollers & Robotics ========================= |
|
|
|
|
|
|
(permalink) |
|
Excellent. Are you going to take it further and build a balancing bot?
Mike. P.S. Are you going to get that FAT16 code written? |
|
|
|
|
|
|
(permalink) | ||
|
Quote:
Quote:
I'll eventually get back to it...
__________________
========================= Futz's Microcontrollers & Robotics ========================= |
|||
|
|
|
|
|
(permalink) | |
|
Quote:
balance002sm.jpgbalance003sm.jpgbalance011sm.jpg A few months ago I caught a guy on his way to the street to put his ancient Meccano set in the garbage. Saved it and now it's my balancer chassis.
__________________
========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 6th May 2008 at 06:28 PM. |
||
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Capacitor Charge/Discharge question | ThermalRunaway | General Electronics Chat | 25 | 12th August 2008 04:48 PM |
| A/D question | YAN-1 | Micro Controllers | 6 | 26th October 2007 12:49 AM |
| Accelerometer Interfacing | jimbo1954 | General Electronics Chat | 4 | 25th September 2007 02:06 PM |