STK-500 based microgram scales

Go To Last Post
85 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all, I've just registered here in hoping that this is the right place for my questions and that I'll be able to learn valuable lessons from some (apparently very) experienced people.

I wish to start a new open source project, but posses no Atmel/embedded know-how. I'm very experienced C & UNIX programmer, though (Linux kernel, IBM AIX extensions), and I wrote a couple of PC HW drivers (mostly USB). I did study electro-faculty, but have forgotten much since those days. :(

This is what I'd like to implement:
http://www.sas.org/tcs/weeklyIss... (the last article "Down Among the Micrograms")

This is what I'm ordering:
1 1 73-1289-ND LCD MODULE 20X2 BLUE CHARACTER 0 17.64000 $17.64
2 1 365-1008-ND SENS OPTO SLOT 4.83MM TRAN W/RES 0 1.40000 $1.40
3 1 LM3046M/NOPB-ND IC TRANSISTOR ARRAY 14-SOIC 0 1.12000 $1.12
4 1 ATSTK500-ND PROGRAMMER AVR STARTER KIT 0 82.16000 $82.16

There is source code for driving these electro-balance scales, but it's in a weird symbolic language. I'd like to reprogram it in C (developing on Linux). If anybody can identify this language, please let me know (extension ".f"):
http://www.sas.org/tcs/weeklyIss...

First of my many questions, if somebody will choose to help me:

1) Code is for STK200, which I understand already came with some CPU. I have to pick a CPU for STK-500, correct? Is there something compatible so that the code will run as is, but also support GCC/C programming? This is the driving circuit and STK board connectors for "Port D". I'd like a CPU that would "plug & play" :)

2) Which power source (ideally from digi-key), would you suggest for the STK-500? I'm in Europe, BTW, 220V sockets here.

3) Any suggestions, tips, links? Perhaps somebody here tried something similar?

Obviously, it's an old project, but I found the necessary replacement parts and it doesn't look that complicated. I learn quickly and won't bother you too much.

I'm just afraid of the STK-500 stuff, it's not described there at all. Which CPU, fuse configs, learning the platform-specific programming, I/O...

When I'm done, I plan to document everything, write a CLI driver interface (via serial port) and a simple GUI drawing a real-time graph of the measurements. Then release everything under GPL. Everything I've written is GPL, so I have plenty experience there.

Thanks in advance!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welcome to the forum.

Quote:
... but posses no Atmel/embedded know-how

Stu_san's Newbie? Start Here! thread is a good place to start.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1. It looks like Forth, a stack oriented language. Use Wiki for some more info.
2. Odd, they don't mention the AVR in the program. Given the year 2000, an AVR with ports A through D, it's likely to be a 40 pin DIP. Best guess for now: 89S8253 or one of the 8051 derivates
We have 230V now in Europe :)
Look in AVR Studio4 for a schematic and other important data on the STK500. Required PS you can find there too.

PortD in the schematic: there are no 2 pins called D8: those are the Vcc and Gnd pins you will find on all port headers. Refer to STK500 schematic.

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Great, thank you. I'm starting to read all the tut's!

Before I begin seriously, I need to get my rig and order everything in one batch (shipping overseas from the US), to be able to test and work with the tut's.

Can you guys help me with the CPU/chip selection for STK-500, then? It must be compatible with the default STK-200 setup, so that I can plug it in STK-500 and code like this will work:

\ Configure STK200 board for GALVO based Microbalance 4/29/00
: INIT-PORTS ( -- )
        $FF DDRA C!  \ PORTA Output to drive LCD
        $CC DDRB C!  \ PORTB KEYPAD Scan/Read bits, SPI
        $F7 DDRC C!  \ PORTC Ext brd select, LCD-RS,EN,SPKR
        $FA DDRD C!  \ Set LCD data to 0's

        $00 PORTA C!  \ PULL UP PB5..PB0 MOSI, MISO, Keypad
        $FF PORTB C!  \ LCD, SPKR, Camera brds
        $00 PORTC C!
        $37 PORTD C!

        $A3 TCCR1A C!
        $01 TCCR1B C!

In the article, they mention it's for AT89/90 series, but I have no idea which kind. Probably one for the analog sockets, but I'm not sure about that either.

Quote:
He used the Atmel AT 89/90 Series flash Microcontroller evaluation kit, which includes a fully functional and extremely versatile microcomputer, one that linked directly to a personal computer. Atmel has since upgraded this unit with something called the AVR-Starter Kit (model STK-500).

I need this running on my STK-500 and using these setup parameters, drive a circuit via "Port D" on the board.

I'm beginning to worry if it's not too complex. :)

UPDATE: Yes, Forth would make sense, I guess, thanks. I'll check it out and see if there's a compiler available somewhere.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK... Where is the rest of the circuitry?

As Nard mentioned, the micros mentioned are antiques.

Get several of several micros. It is possible to damage one, or inadvertantly mis-set the clock, and you will do well to have several in your parts bin if you are ordering from the USA.

I'd think most of the stuff could be ordered from Europe, if that saves you any time, tariffs, etc.

The article mentions a PID controller and elludes to a PWM, (Pulse Width Modulated), drive signal. PWM can be done on any AVR.

The article mentions using the LED and phototransistor to see when the analog meter movement is blocking the LED light transmission. One would generally use a fully electronic solution these days, rather than incorporate a mechanical meter movement into the feedback loop, but who am I to argue with the designer...

There is nothing special about Port D. You need some pins for the LCD mentioned, and for the PWM output, and for reading the phototansistor. The nice thing about AVRs is that it is relatively easy to switch hardware around from pin to pin, and from port to port.

If you are using the STK500 you will want a couple of micros that come in PDIP packages, the plastic ICs you can plug into the STK500's sockets.

A Mega168 ight be a reasonable starting point.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Plons wrote:
Look in AVR Studio4 for a schematic and other important data on the STK500. Required PS you can find there too.

What is "PS"? I could probably look up STK-200 for which this was designed and compare with the new STK-500, right? Problem is, I don't understand the stuff at all and even such a simple comparison will be an undertaking for me.

I was hoping to meet with people who would know this kind of stuff perhaps from personal experience.

Plons wrote:
PortD in the schematic: there are no 2 pins called D8: those are the Vcc and Gnd pins you will find on all port headers. Refer to STK500 schematic.

You're right, of course, that's probably a typo. They only use pins D2-D7.

Basically, all I need from you guys is help with the AVR selection for STK-500 to match the capabilities of a "stock" STK-200. The programming & circuit design is not a problem. AVR docs and available tut's will suffice. I have to order appropriate HW first, though, and that's the part for which I need your expertise.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:
Get several of several micros. It is possible to damage one, or inadvertantly mis-set the clock, and you will do well to have several in your parts bin if you are ordering from the USA.

I'm definitely going to order several of everything. :)

DocJC wrote:
The article mentions using the LED and phototransistor to see when the analog meter movement is blocking the LED light transmission. One would generally use a fully electronic solution these days, rather than incorporate a mechanical meter movement into the feedback loop, but who am I to argue with the designer...

I'm sure this is true, but I have literally no idea what electronic solutions are there and how to adjust everything properly. Well, I probably could adjust the circuit and rewrite the routines, but I first intend to make it work as-is, just to be sure that one part of the project is definitely OK and that I can concentrate on debugging the STK/AVR part.

If you have better ideas, I'm up for it. For example, this guy's scales look much better and modern:
http://www.national.com/en/video...
It's just a video, however, and no docs available. I couldn't piece it together in a thousand years. :(

Do you know of any EU suppliers that have good prices? I picked Digi-Key, because they have the exact same parts (with minor replacements). For example, right now, I have no idea how LCD's work and if I could pick some other - better, modern - panel instead. I doubt they all use the same interface.

I also need the STK-500, some AVR, and a current mirror with similar parameters (e.g. no idea if this would work the same: http://parts.digikey.com/1/parts/571791-ic-current-mirror-sot223-8-zds1009ta.html). I'll get several types of these components and try my luck. Perhaps somebody will help out with the selection, but I guess it's OFF TOPIC here.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

PS - power supply.

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just found this "Arduino" thing, that might be better for my purpose! It's much smaller and pre-set with a CPU etc. There are even some tiny ones. Really cute. :)

Can you tell me if the I/O ports (the voltage in/out?) in the design above could be handled by the Arduino board with a custom application?

Are there any pros/cons against choosing the STK for this particular (simple??) purpose?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's a good idea to complete your profile: we don't know where you live. And that makes the difference on where to order your stuff.

For the LCD: a HD44780 based character LCD is bullit proof. HW (HardWare) and SW wise.

For the current-mirror: it's no big deal to make that with standard parts. A dedicated IC is OK, but then it's just that specific function.

PS stands for Power Supply; sorry for not explaining that.
I'd be surprised if you don't have one @ home: from an old modem, router, etc.

An ATMega16 or 32 will give sufficient freedom and plenty of pins. Doc's suggestion for a Mega168 (there is a whole family: 48 88 168 328: same package and peripherals, just each step bigger flash) is okay too, but an LCD uses about one port, then you probably want some comm with a terminal, and all the pins for the experiment itself: I'd go for a 40 pins. M16 or 32 as mentioned. More freedom.

Download and use AVR Studio4. Leave AVR Studio5 for what it is at the moment. It's still beta.
Then your C compiler: GCC is widely used. See the tutorial section for that.

You already mention that this project may be a too complex one to start with. Not problem IMO, just start with getting the LCD to work, serial comm, flas some leds, read switches, fiddle timers, get familiar with HW and SW environment, .... and you'll be okay.

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Arduino is a good starting point too. But like I wrote: you may run out of pins.
And if you have a STK500, I see not much advantage in going Arduino. But you can.

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The STK500 will come with a ATmega16. This will be quite suitable for your project. It may even come with a more modern ATmwga164.

Your power supply can be any wall-wart that produces 9VDC .. 18VDC. I have drawers full of them. Fax machines, telephones, routers, scanners, modems, cuddly toys often have a 12V wall-wart. Note that a lot of phone equipment have AC wall warts.

The Forth program looks fun. See what Google comes up with.

Otherwise, it should be fairly simple to re-write in C.

It looks like fun. Definitely a challenge for a first project!

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Profile updated, sorry.

Yes, this is definitely going to be a challenge, but I always learn new stuff by jumping to the deep end. Well, if there's enough on-line info about specific details.

I'll check out Arduino, the ones that have enough PINs. I'll need real-time communication via RS232 (or USB-to-serial) to read the measurement, text LCD display, 1 LED, 1 photo-transistor sensor, 1-2 buttons, and PWM driving/interrupting the main circuit. I guess each of these require 2 PIN's, right?

At this point, I don't have any HW. I'm here mainly to get an advice on which AVR HW to get.

The desing doesn't have any DC filtering, they even suggested 9V batteries originally. The smallest of oscillations will throw the scale's precision off. Perhaps some additional voltage regulator IC would help here if I use a regular crap AC/DC adapter?

DocJC mentioned the LED/detect could be replaced by an electronic version. Could you provide some details?

The thing is: I need to adjust the current by programmatically adjusting PWM, based on feed-back. The feed-back is reporting how far high/low (or at what angle) a rotating horizontal needle is from a specific point (zero degrees). This needs to be fairly precise.

The plan is to take a needle/coil from a galvanometer (do you know of a good one, with long needle?). The PWM adjustments keep the needle horizontal by regulating the current. Application is calibrated by F1 calibration weights (0mg, 1mg, 500mg) to setup PWM ratio -> weight equation.

The feed-back and PWM resolution dictates the scale's precision. Whatever electronic/mechanical ideas you have for the feed-back (even tips), I'm excited to hear!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, I'm a bit wiser now. :)

Arduino uses chips that have 28 pins. Of that there are 12 digital in/out pins (6 of which can drive PWM with independent timers) and 6 analog-in's (or 6 digital in/out's, if so desired).

Normally, PWM has only 256 step resolution, but PWM timer 1 can be set to a 16-bit resolution by direct register manipulation, which is awesome, because I need at least 10-bit resolution PWM.

The number of pins will be enough and the board is nicely compact. Plus, I can always pull the ATmega out, connect it to a 16MHz crystal and a voltage regulator and use it inside the scales without the development board. Arduino is just a programmer, right? If I supply 5V to the AVR and let it tick @ 16MHz, it will work just fine without the board, correct?

If this isn't the right place to discuss Arduino, just tell me, but I think these questions are relevant, because I'm really deciding on an AVR model here.

Are the pin numbers correct for ATmega328p?
- LCD = 7 pins (in 4-bit mode)
- 10-bit PWM = 2 pins (PB1,2)
- LED = 1 pin
- photodetector = 1 pin
- button = 1 pin

Max. current on these pins, however, is 40 mA, that's not much. What if I need more to drive the coil? What's the usual solution here?

Thank you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Let me see if I can clarify some things.
1. The STK500 is a development platform. Not a production platform. It is convenient to use because of it's built-in ISP (InSystemProgrammer), adjustable Vcc for the AVR under development, 8 push-buttons, 8 led's, and it accepts a whole range of microcontrollers in DIP (Dual In Line) packages. So flexible and handy.
Downside: it's a bit outdated: RS232. You'll need USB-to-serial adapter(s) if your PC has no RS232 anymore. Valid for most laptops.
2. Arduino. Is a "I wanna make .... "-platform. It's not a programmer though: every Arduino comes with an AVR which has been programmed with a bootloader. But you can turn an Arduino into an ISP-programmer. So buy at least two Arduino's, because sooner or later you'll need an ISP-programmer for setting fuses and so.
3. You are clearly a bitpusher :) 40mA per pin is fantastic ! Older micro's could sink 5mA and source 1mA, if you were lucky. Your galvanometer will need just 1mA or so.

I think you should divide your plan into 2 pieces: a development system part and a dedicated project part. Two beasts.

Nard

PS Buy some protoshields for the Arduino: you can put the circuitry for the project on that without having to tamper with wires in the Arduino's sockets.

PS2: the STK500 can also program external targets with it's ISP-circuit. So you're not limited to the on-board AVR target.

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you really think that you will run out of pins, I can recommend the Arduino Mega. Here is one supplier.

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1) I understand. But, if simple Arduino has enough pins for my purpose, it's much smaller and easier to work with (already has app management, libraries, etc. built-in, no need to code everything from scratch), so I'll probably get that.

2) Arduino is an easy to setup debug/devel platform. The chips that come with it are already programmed with a bootloader that makes pushing & managing code easier (real programmer not required). If I wanted to replace the chip with a new one, for example, I'd have to use AVRISP and upload the bootloader to the blank chip with first. Or code straight away without Arduino bootloader, but basically from scratch, no comfy devel. support. Correct?

3) A bitpusher, you say. :) It's just that I've been working with power e-cigarettes lately and the currents I'm used to are ~500mA. I have no general idea about currents in other devices. As you say, the meter will most likely top at ~5mA, so that's plenty of power.

4) Yes, I'm planning on getting the devel system and getting it in hand first. Using I/O, driving the LCD, etc. As with SW platforms I often learn from scratch for programming purposes. Then, when I know 1+1, I'll start building the project.

5) If I get Arduino + AVRISP, is that enough to do whatever could possibly come up during the course of the project? If I get 2x Arduino, I still don't have any means to flash a blank chip, right?

6) Serial communication. How does that work on Arduino? I mean, do I need to reserve more pins to make my app able to interact with the PC while running? Like sending some calibration data, reading measured weight in real-time? Or can I use the USB-serial interface already in place? If not, I'm probably gonna run out of pins. :(

Great tip on the protoshields. Didn't know such thing existed, very convenient!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:
If you really think that you will run out of pins, I can recommend the Arduino Mega. Here is one supplier.

Wow! What a beast. :) Thank you, very useful information.

From there I found there's also Arduino Mega2560, which has quite a lot of pins too, though not as many as yours. :) These non-Uno models have their chips hardwired, I see. I hope regular Uno will suffice.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are more roads that lead to Prague, so it's just a matter of "taste" and choice.
With the STK500 you can't go wrong: it's a good investment, even in these days.

For your project, an Arduino or MegaArduino will do great. Another pro that popped into my mind is that you can buy ready-built shields for the Arduino with specific circuitry on it. BlueTooth f.i., Zigbee etc.

1. About pincount: it's more than that. If you use one port for the LCD, you may have lost one or two peripheral in- or output pins. Therefor my recommendation for a larger beast.
2. If you "sacrifice" one Arduino, you can turn that into an ISP-programmer. And with that you can do anything you need to do with AVR's: programming flash, eeprom, set clock and fusebits etc
3. Bitpusher is the word I learned over here from Lee, Theush. I am a sparky. Then there are rust-scratchers, carpenters and so on :)
5. I am not 100% sure of that. I don't use Arduino for ISP. But I do use a lot Arduino to serve as the base-board for one-off projects. Put a shield on top (or two shields, .. they are stackable) and off you go!
6. Most Arduino's have an FTDI FT232R on board that is connected with the RxD and TxD pins of the Arduino AVR. There is no second Uart in the 48, 88, 168 etc
Newer Arduino's carry an Atmel USB chip. But that's all very new.

Bedtime
Sleep well

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mavey80
A new galvo (meter movement) that size will be expensive. Look at the surplus/antique lab equipment market or EBAY. They tend to be large and rugged. With the stiction problem overcome with the pwm pulses, a jeweled movement will be adequate. They may be 50 uA to 5 mA full scale sensitivity. They will be position sensitive and may need to be rebalanced for the final position. Try to keep the movement sealed to the greatest extent possible. If you locate an affordable taut band movement, there won't be any bearings to contaminate lessening the sealing requirement.

Rick

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

RickB wrote:
mavey80
A new galvo (meter movement) that size will be expensive. Look at the surplus/antique lab equipment market or EBAY. They tend to be large and rugged.
Rick

Thanks, this mechanical part will be crucial. Didn't know about the jewel/taut versions. Hopefully, I'll find something good.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I like the STK500. It is very nice to develop on.

The standard Arduino has probably got enough pins for your project. Most 'shields' are designed for the standard Arduino. If you choose the 'mega' variety, it has lots of i/o pins but less software and hardware available.

The Arduino needs no external programmer or power supply. Just one USB cable and away you go.

Let us know if you can find an AVR Forth interpreter.
Otherwise the software will need to be re-written in C, C++, or 'Arduino-ese'.

Incidentally, I would guess that the Forth program was for a AT90S8515 or AT90S8535. Both are AVR devices with modern replacements. In fact you get both replacement chips with a new STK500.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Plons wrote:
1. About pincount: it's more than that. If you use one port for the LCD, you may have lost one or two peripheral in- or output pins. Therefor my recommendation for a larger beast.

6. Most Arduino's have an FTDI FT232R on board that is connected with the RxD and TxD pins of the Arduino AVR. There is no second Uart in the 48, 88, 168 etc
Newer Arduino's carry an Atmel USB chip. But that's all very new.


1. How come? I thought the 12+6 pins are independent (not considering special functions like PWM, etc). LCD in a 4-bit mode requires 7 pins, do you think I could lose even more than that? Why?

6. I found an example of using the serial interface form the application. Cool. That should be enough and doesn't use up any pins (I didn't count pins 0 & 1 in the totals).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

1. How come? I thought the 12+6 pins are independent (not considering special functions like PWM, etc). LCD in a 4-bit mode requires 7 pins, do you think I could lose even more than that? Why?

Normally, to simplify the access code, you try to collect all the LCD lines on a single port with maybe D0..D3 on bits 0..3 and E, R/W, RS on upper bits. The chances are there's going to be something else living on that same port that you might then lose access to. If you are using avr-gcc you can use Peter Fleury's LCD driver (Bob!) code and it lets you assign every data bit and control line to different ports if you want, even D0..D3 don't need to be grouped together.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@David: USB power is far too unstable for OP's microgram project.
@Cliff: that solves the problem. In Bascom we have a simular library written by Luciano. I use it all the time, never looked back on the standard one's.

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
If you are using avr-gcc you can use Peter Fleury's LCD driver (Bob!) code and it lets you assign every data bit and control line to different ports if you want, even D0..D3 don't need to be grouped together.

I see. OK. Your're right. On the UNO, I'll need the analog-in's port for 1 analog-in, 2 pins from the 8-13 pins port for Timer 1 PWM, and that leaves only 0-7 port from which I'll need pins 0 & 1 for serial communication.

So I'd definitely need to split the LCD pins across different ports. Or use the MEGA version, which is what I'm gonna do, because the UNO pin count is tight as it is, without any extras.

Thank you all for these nuggets of gold! Yesterday morning, I knew absolutely nothing about this and now? I'm aware of my options, know what I need and why I need it, basic principles, requirements and constraints or this platform... Amazing. I knew you'd be of great help, guys.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Plons wrote:
@David: USB power is far too unstable for OP's microgram project.
@Cliff: that solves the problem. In Bascom we have a simular library written by Luciano. I use it all the time, never looked back on the standard one's.

What kind of PS (or stabilization) would you suggest, clawson, to get a perfect DC for this project? LiIon battery-powered Arduino OK?

I'm still not sure how to plug in the LiIon battery with a supporting charger "brick". I'll have to research. Ideally, I'd like to have a usable stable DC even while charging the battery. That might a problem, I guess.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

What kind of PS (or stabilization) would you suggest, clawson, to get a perfect DC for this project?

Your speaking a language I don't understand - I'm a programmer, not a hardware engineer - I leave that kind of thing to the sparkies so us bit-manglers can get on with what we do best.

BTW in another life I'm a flyer of R/C helis and planks and I've seen some pretty explosive things happen with LiPo/LiIon power so, whatever you do, make sure you use an intelligent controller chip that knows about the constant -current/constant-voltage switch that must occur when the cell reaches 4.2V - see http://batteryuniversity.com/lea... for details. Use a dedicated chip for this - not some home brew circuit or you may have to a finger/arm recount at some stage.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Use a dedicated chip for this - not some home brew circuit or you may have to a finger/arm recount at some stage.

Don't worry, I'd never try anything like that. I've been working with LiIons on e-cigarettes so I have some idea how dangerous they are.

I'm only a programmer myself too, until now, that is. I have to learn enough HW stuff to build my new hobby project. :) I think it'll be fun.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I leave that kind of thing to the sparkies so us bit-manglers can get on with what we do best.
:)

mavey80, the Arduino has an on-board voltage stabilizer. There is a jumper close to the USB-plug that you can set to "use external supply". Feed the Arduino with 8 to max 12V DC from a wall-wart (the black bricks). Since your application is very sensitive to fluxctuations in Vcc it may be necessary to have a close look at groundloops: powering the Arduino with a (rechargable) battery like the Forth-guys did is probably a good idea. 8 NiMH penlights aren't expensive these days, and there are good chargers available on the market.

Edit: oh, for sure, fun it will be :)

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You mean the options are to use wall-wart, or better - for precision - use batteries. Either way, switch to external supply mode. Not using USB power. Yes?

Have a look at groundloops? I know a bit about groundloops (different potentials of supposedly grounded components), but how does that translate to this Arduino design? Should I read up on some theory?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As a general rule you can spread the LCD or LED pins about quite freely. It does mean that you cannot use those Arduino functions that expect a particular configuration.

Things like PWM (OCxx) or ICP pins are fixed in hardware.

It is relatively trivial to move a LCD pin or two.

I think you will find the Arduino voltage is not bad. I would run from 3.3V anyway. It should certainly be good enough to get your software up and running.

The final precision is probably going to mean 'good analog design' with clean supplies, r.f. shielding etc.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
You mean the options are to use wall-wart, or better - for precision - use batteries. Either way, switch to external supply mode. Not using USB power. Yes?
Yes

Quote:
Have a look at groundloops?
When you have the Arduino connected to the PC over USB, the ground of the PC is also present on the ground of the Arduino. OK ? Now, when you power the Arduino with a modern wall-wart using SMPS (Switching Mode Power Supply), it's very likely that the outgoing lead has a small capacitor between the lead and one of the primary terminals. That's how they limit the amount of radiated switching frequency. Since these two grounds are connected on the Arduino, that leaking high frequency from the wallwart is present on the ground of the Arduino and flows into PC-ground.
Since your project is very sensitive for any power fluctuations you may encounter unstable readings. Therefor battery power is recommended.

Groungloops can also occur when you connect an oscilloscope: the groundclip of the probe is connected with safetyground. And now there is a current flow from the (also noisy) PC-PS through USB to safety ground.

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think I understand. I'm gonna read some theory about this and read your post again, to make sure I get the full implications.

EDIT: In the mean time, if you feel like it, would you watch this 3min video and tell me what kind of feedback they use? It's the same project, but the feedback looks much better. There's a rough circuit sketch, which I don't really understand:
http://www.national.com/en/video...

My device would keep the needle between a LED and a detector - kind of precarious. Hard to guess which way to move when it leaves the position and not very accurate, I'd say.

EDIT2: OK, now that you've taught me stuff, :) I recognize it's also a LED/detect method, so nothing new there, but it looks better - he uses some I/V converter and op-amp. Why? I don't know. Sensitivity, perhaps.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I dug up an old thread on leakage of SMPS's: http://www.avrfreaks.net/index.p...
I still have a webpage about it: http://www.aplomb.nl/SMPS_leakag...

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Plons wrote:
I dug up an old thread on leakage of SMPS's: http://www.avrfreaks.net/index.p...
I still have a webpage about it: http://www.aplomb.nl/SMPS_leakag...

Great! I'm gonna read/skim the whole thread.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lovely video. But it has a flaw *): with the eyelash on, the needle will not return to the zero position but hang a bit lower: it requires an integrator to compensate for that. Of course in SW !
He is using a photo interrupter in analog mode. The current through the transistor depends on how much light of the diode reaches it. Therefor the I to U converter.
It's a good idea to do it that way; better than an on-off system.

Nard

*) Flaw is a bit too brusque to say, but it is a flaw. A tiny one :)

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Damn! I should have paid more attention at school. What does integral mean in this context (I can do integration/derivation symbolically)? I'll have to research that when I'm in the final fine-tuning stage. :)

BTW: I'm looking at those PS tests and ground loops and I've noticed an oscilloscope there. I should probably get one, if it's not too pricey. Do you know these cheap ones? For a super-amateur like me, could be just the ticket:

http://www.hwkitchen.com/product...
http://www.hwkitchen.com/product...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Do you know these cheap ones?

The second of those is FAR better than the first in terms of bandwidth (one of the key measures of how useful a scope is going to be). You might also want to see this page:

http://www.gabotronics.com/resou...

which is an easily searchable comparison of a lot of "low end" scopes. If you type something like "> 30" in the Ms/s box then look at the price column the cheapest seems to be:

http://www.ulrichradig.de/home/i...

Last Edited: Mon. Sep 5, 2011 - 03:22 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The first one (lowest price) is hardly of any use: 1MHz bandwidth is too small.
The second one looks already much better :)

There were several threads in the General Electronics forum: do a search over there.

And quite recently a fellow freak made a nice one ... I can't remember the name ... Cliff knows I guess ... he knows so much :)

Edit: right on !

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a document somewhere on PID. If you PM me your private mail address I can send it to you

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The second one is more expensive, although the feature set looks great. I don't know many of them, but can see the difference. Being able to see Vmin/max, shape, etc. must be extremely useful.

The board osc. w/o display is cheap, but the GUI looks too simple, like it doesn't have as many functions as the DSO Quad. Plus, PC required.

I'm asking because I would shell out €174 for a useless junk without batting an eye. :)

Do you think it would be useful for this kind of project? I only have a meter like this:
http://www.northerntool.com/imag...

EDIT: Thanks! My email is foceni at gmail. It's not secret.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I'm asking because I would shell out €174 for a useless junk without batting an eye.

Did you see my edit above? That AVR-DSO is a better scope (IMAO) for €55. However it does require a PC/laptop to act as the output display device (a lot cheaper scopes and logic analysers do to save cost)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Do you think it would be useful for this kind of project?

Yes.

If I were building this I would have a soldering iron in one hand and a scope probe in the other.

Lee, on the other hand, would have a Logic Probe in one hand, instead of a scope probe.

(But since this is an analog circuit he might have to break down and use a scope...)

This circuit uses very low frequency signals. Any scope will be fine for this project. If your interest in hardware continues to grow, and you take on other projects, you will find that a low priced scope is often too limited in its performance to be of much use. But spending a lot of money for a high end scope, if it is only collecting dust on the shelf, doesn't make much sense, either.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Did you see my edit above? That AVR-DSO is a better scope (IMAO) for €55. However it does require a PC/laptop to act as the output display device (a lot cheaper scopes and logic analysers do to save cost)

If it has auto measure of Vmax, Vmin, freq, duty cycle, etc. it's OK and very cheap too, but I understood that it's a DIY project. I'd have to buy the components, solder, program chips, etc. That could take as much time as my "scale for dummies". :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

DocJC wrote:
If I were building this I would have a soldering iron in one hand and a scope probe in the other.

Adding to my queue of skills to acquire: using an oscilloscope!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And your multimeter is good enough to start with.

You've gathered quite something on your plate ... in 24 hours.
Bon appetit.

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yep. Entirely thanks to you guys. I'm gonna order the HW and start hacking away.

In the mean time, I have some physics classes to remember, learn about PIM, oscilloscope use, Mega2560 chip, get Arduino toolchain, research battery/charger options, etc.

I'm gonna drop back here whenever I have a related question, if that's OK.

Before that, do you know how this is used?
http://www.hwkitchen.com/product...
http://www.hwkitchen.com/product...

If you hook them up to a LiPo battery which is powering the board - is the battery usable at the same time? Does the current then come "from the battery" or "from the charger". In reference to the voltage stability we spoke about for this project. I can't find how this is connected and how it works... :-/

David

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
If you hook them up to a LiPo battery which is powering the board - is the battery usable at the same time? Does the current then come "from the battery" or "from the charger". In reference to the voltage stability we spoke about for this project. I can't find how this is connected and how it works... :-/
No, you shouldn't connect the charger when the microgram project is working. Run it from just the LiPo. Check to see if the battery has a protectioncircuit built-in; if not, you'll need one.

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK.

And last, but not least - do you know of a good EU e-shop for IC's, LCD's, breadboards, etc? Czech Republic has a great tradition in hobby electronics, but I can't find anything remotely as comprehensive as e.g. Digi-Key. Regular specialized shops are a dime a dozen here, but their supply is too restricted compared to on-line catalogs. They're very cheap, however (good for resistors, caps, diodes, etc).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

http://server4.gs-shop.de/200/cg...
http://www.mikroe.com/eng/home/i...

And I buy also from Dutch webshops, order stuff in groupbuys but all that that doesn't help you a lot.
A fellow freak nearby, that would be handy !

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, reporting progress.

- Read up on PID generals, have needle-stabilization algo more or less prepared.
- HW order prepared for shipment, most stuff is 3x. :)
- Learned Forth basics and fully decoded the source code from the PDF. Rewriting in C is going to be trivial.
- In the process learned about DDR, PORTx/PINx, serial com, LCD setup & use, PWM setup for hi-res
- Now learning how op amps work in case I need them

Here's a redrawn circuit of the newer design. I'm not really getting what is hooked where:

Personally, I would hook up the galvo/resistor on the PWM pin, IR-LED on next pin, IR-detector (with optional op-amp) on next pin. That way, I have control of all three parts.

In his design, I don't see what should be hooked to the board. There's Vmeasure for sensing, Vbias (probably) feeding the whole circuit (that looks completely wrong to me). Why have everything on one circuit?

1) What do you think?
2) All op amps of this kind have 5 pins: +, -, Vout and V+/V- powering the positive/negative output amplification. In his design, he hooks photo detector current to the "-" input, puts Vbias on the "+". I guess he also hooks up the +5V supply to the V+. No V- (GND connected there?), because the signal is all positive. Correct? I suspect not. :) I really don't get it yet. What's the purpose of Vbias.

Thanks, David

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The idea is: if the slot detector is half covered with the pennon that is attached to the needle, Vbias needs to be set such that the needle is in the center position. See bias as null-compensation, or offset.

The National guy did not use a microcontroller, and you will. I think you can skip the OpAmp.

But you need to do some experiments first:
Connect the IR-diode with a resistor in series to 5V. The resistor can be roughly 680 Ohm or so. That will let a current flow through the diode of appr. 5mA.
Connect the collector of the IR transistor to 5V, the emittor with 10kOhm to ground. Make a pennon (metal, aluminium foil f.i. or black plastic) and move that in and out the slot. Hookup your multimeter to the 10k resistor and measure the voltagedrop. From that you can calculate the current.
With the pennon full in, there should be very little voltage, with the pennon out a voltage of 2 to 4V. You may need to increase or decrease the current through the diode, but read the datasheet first on what the maximum is. You may also have to fiddle with the value of the 10k. And you need to get a good feeling on how sensitive or unsensitive the IR transistor is for ambient light. Test that during the day and during the night (with lights on)
You want a good sensitivity of the detector in the middle: pennon half in.

The galvanometer: look up how much current it needs, and calculate the series resistor from that.

That's it for now. Bedtime for me.
Have fun :)

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The National guy did use a micro-controller, a Basic Stamp in fact. No other way to drive the lcd. Lower right hand corner next to the DB-9.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You are so right; how did I mis that ? But will it be just a readout of Vmeasure or will it be part of the loop ? The challenge was to measure an eyelash with National's opamps.

My estimates for the experiment turned out to be quite close: 680R and 10k work fine for the slot detector I have.

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Excellent. Thing are coming together... :) Thanks guys!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!

I recently learned that to make the measurements somewhat more accurate, I could use a voltage divider to get < 5V on the AREF, in which case the ADC on analog inputs would have a higher resolution (1024 parts on e.g. 3.3V).

Depending on the resistance (voltage drop) of the meter (or the serially connected resistor, might be better), it could be significantly less than full 5V.

But when decoding the Forth source, I realized I already know how much power is feeding the meter - it's the PWM duty ratio.

Do you think I can measure from that like the original project? Or would using an analog input to measure some part of the circuit separately (as suggested by the NatSemi guy) be better (in which case I have a value from PWM + value from galvo, and they need not necessarily agree!).

David

PS: complete HW list ordered. :) In the end, I settled for the cheapest normal-size assembled board: Seeeduino. After re-counting pins, it has enough (some will remain unused). Plus, it'll be easier to port to one of those cheap mini/nano boards weighing 1g, because their layout & pins match exactly.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

David,

The Forth-guys use a successive approximation algorythm (you may have to look that up on Wiki f.i.), and use the slotted detector as "too high/too low" indicator. So a binary.

The National guy uses the slotted detector in an analog way: pennon position determines amount of IR-light, light to current, then current to voltage, add bias, and use that to drive the galvanometer. From what I learned so far the Basic stamp is used for readout only, though we cannot be sure of that.

The question is now: what approach do YOU want to take ?
Copy one of these two approaches ? Combine them ? Or have a good time fiddling with available data and sorting out a new method, HW-wise and SW-wise .... ?

PS The decision for which reference to use for the ADC: think about what the Forth guys did. What kind of "ADC" are they using .... mow many bits ... ?

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to the right of the video it shows the main parts used for the scale. No other docs were found, such as schematic, software, etc.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm commited to "doing it my way". :) Different HW, different approach. Whatever will work the best during testing, I'll use that.

Based on what I've learned and can comprehend, this is my intention:

1) I'll drive the galvo with PWM, nothing else in that circuit (with a pot for fine tuning galvo range)

2) I'll use IR-LED with phototransistor and a pennon to get analog reading. Definitely. Let's say at 50% of the LED-OFF/LED-ON current range, the pennon is exactly in the middle of them. That'll be the fixed (zero) position for the scale and I can tell (by a rise/drop in the photo current) whether I need to push or pull the galvo.

3) Scale will calibrate itself by:
- reading (A) PWM % required to get "zero" with no load
- reading (B) PWM % required to get zero with 100mg load
- calculate a linear function approximating these two points

After boot, the scale balances itself to zero, acquiring value A (LCD says "starting"). It keeps balancing (LCD says "calibrate"), until user places 100mg reference load and presses "CALIB" button. That will set value B. When the scale has value A & B, it will start displaying the weight on LCD.

This will be optimized by storing A & B in EEPROM (AE, BE), so as not to need calibration every time. After boot, A is calculated and if AE & BE are available, it is offset by the same amount A is offset to AE). Not very precise, but hey, what do you want w/o calibration. :)

"TARE" button will save current weight to "T" and subtract it from the live weight measurement (until user presses TARE with no load). By default T=0.

4) The actual weight measurement: PWM is giving 0-5V in at least 1024 increments. Optical feedback is used to change the duty cycle +/- to get to the "zero" value, which I know means "pennon is in middle" (and for now is hard-coded). A is PWM% to get empty needle to zero position, B is PWM% to get 100mg to zero position. Weight (mg) = (PWM% - A) * (100 / (B - A)) (linear interpolation).

PS: Rewritten and in places better formatted Forth source easier to understand:
http://pastebin.com/ZEMn3DWX

Their PWM drive is based on bit flipping the 10-bit PWM duty cycle register bits to HIGH. Goes from MSB, when it overshoots, sets bit LOW and moves to the next one. This makes the needle as high as possible, but not so high as to leave the detector slot. Apparently, it too works fine (has clear boundaries too).

So there's no ADC in use at all. They go by PWM% and the slot, which is the same I'm going to do. Just in a slightly different way.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the update. Have fun!

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, I have a question about op-amps. What's the deal with V+/V-? Does every amplifying configuration (with or without negative feedback) require both supplies? AFAIK, there's no V- available on AVR chips or Arduino-based boards. And I understand it's not a trivial task to "get" one. Everybody suggests the "two batteries" solution, but that's not possible when the supply is USB, wall-wart, etc. How do you make it work?

If I want to use an op-amp as a non-inverting amplifier, do I still have to supply both V+/V- on the two supply pins?

David

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

About the photo detector hook up - can the photo transistor have Vcc/GND connected over the collector-emitter?

In that case, I thought, I wouldn't have to amplify the (photo) current using an op-amp. The transistor itself would "amplify". Small (photo) current on the base regulates a larger current across C-E. My only issue with this solution is how would I hook it up to analog-in.

Would something like this (but amplifying, not switching) be OK? (Vcc = 5V, Vout => analog-in)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I used the circuit as in figure 9 B. No need for an OpAmp. If RL=10k, add a 100nF capacitor over RL: it creates a low pass filter with Tau=1ms. Connect Vout to an analog input of the AVR.

There are 5V rail-to-rail OpAmps available, but I don't have a typenumber for you. Where do you plan to put an OpAmp ? What are the voltages at the inputs (what range are they in) ?

The OpAmp comes from the analog world. A dual supply is quite common there. Yes, I think we have a problem if we need to make a negative supply voltage.
Problem is: a microgram balance needs carefull design: a small offset, a bit of noise, a varying supply voltage are killers of accuracy.

Your project is fun and challenging, but there are a few more bears on the road ahead. And beers, but that's another story.

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Example of search attached

You can also post your OpAmp-question (which one to use for .... and able to ....) in the General Electronics forum.

Attachment(s): 

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The opamp question was just out of curiosity. I'm reading about them a lot to learn something new and just in case.

I'll use just a transistor in the balance.

Your suggestion regarding the cap is to make an RC filter, right? I may have to add more caps to filter as much noise as possible. Like this guy:

I'm leaving for abroad (3 weeks) on business, but I may work on it at the hotel. Evenings are usually pretty boring there. I'll be online and keep researching.

I was thinking the level detector is going to be crucial (even more than stable supply). Consider how little the needle bends when you put an eyelash on it! The detector has to be able to recognize it. I need to "multiply" the tiny movement somehow. E.g. like placing the pennon at the farther end, not by the coil. Angular distance is longer there. Or come up with a different detector. Perhaps something based on magnetic fields.

Check the NatSemi version, his photo detector is just below the needle's center of rotation, where it's fixed. If he's measuring the tiny distance the circular plate turns, it must less sensitive than with a pennon at the other end of the needle, being lowered (dipped) into the detector...

What do you think?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Two, 9-Volt batteries in series is not needed to drive the 7805. The "extra" voltage is just wasted as heat in the 5 V regulator.

You can put the two, 9-V batteries in parallel to give a higher current capability, and to have the supply last longer. 9-V batteries do not contain much energy in total.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I know, it only was attached as an illustration to my comment about maybe needing some caps to do filtering of imperfect DC.

Last Edited: Sun. Sep 11, 2011 - 07:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But here's an idea. I'm still trying to come up with a better "level" detector. Photo detector is not very precise, it probably doesn't register a minute movement of the needle when you put an eyelash on it.

I was thinking of using something based on electromagnetism. Such things could be tuned to be very sensitive, right? For example, look at this (or something similar):
http://www.watterott.com/de/Magn...
( http://www.watterott.com/de/Trip... )

I don't know if this is as sensitive as I would require, but you might know about other sensors or elecro. effects that could be used to detect proximity. Say - max range of <1cm would be enough, but when <1mm close, it would tell you with extreme precision how many micrometers the needle is from the detector.

Such a detector could be placed 1mm above the needle in "zero" (horizontal) position. The rest is the same. But I would have much more precise way of being able to say "the needle is exactly horizontal now".

You see how much it would increase precision? I could make the needle like 30cm long, in which case it would drop much lower when you place a tiny weight at the end (as opposed to a needle 5cm log). Fulcrum/lever principle. But I don't particularly want to modify the needle/coil itself. I could make it worse than it was. :)

Thanks for your opinions.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I was thinking the level detector is going to be crucial (even more than stable supply).
Interesting: I have more worries on the stability of Vcc than the slot detector. Even better: I was very pleased with how sensitive the slot detector worked.
Other things to think about are: temperature variances, the galvano needs to be current driven instead of voltage driven, the few mV's drop and noise in the groundtracks from Arduino to proto shield etc.

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I could make the needle like 30cm long, in which case

No, probably not a good idea.
As you make the needle on the meter longer you also add significantly to its mass. Although the length of the leverage arm is important, and increases as you make the arm longer, the % mass of the eyelash to the total system's mass, (lever arm + eyelash), becomes smaller.

Although a high resolution feedback system will compensate for the mass of the weighting system, it is still limited.

It is difficult to weigh very light objects, (e.g. eyelash), with a massive scale.

JC

Edit: Typo.

Last Edited: Mon. Sep 12, 2011 - 08:23 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I envision a very small piece of very thin aluminum foil wrapped over the needle, making it like a flag, (only horizontally oriented).

As the needle moves across the LED/Photodiode gap the amount of light varies.

Using the photo interrupter in a linear mode like this would be expected to give very fine positioning resolution.

I think you should test such a system on the bench top before moving to alternatives.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm just thinking about it from different perspectives while I wait for the HW. :)

DocJC wrote:
I think you should test such a system on the bench top before moving to alternatives.

That's sensible. I'll probably go with the original designs mixed together. These are just ideas.

DocJC wrote:
As you make the needle on the matter longer you also add significantly to its mass.

True, I was thinking of ideally replacing the needle with something much lighter and somewhat longer. Not sure I'll be able to find such a material. The right balance of length/weight would be crucial.

Plons wrote:
Other things to think about are: temperature variances, the galvano needs to be current driven instead of voltage driven, the few mV's drop and noise in the groundtracks from Arduino to proto shield etc.

Do you think the older article's current mirror idea would help accuracy? E.i. instead of driving the galvo directly with a series pot (limiting the current), put the pot on one side of a mirror and the galvo on the other side. I'm still not sure about the full benefits of a current mirror, but I understand it supplies constant current more-or-less independently of the load (on the mirroring side). If not reducing the noise/groundloops/etc, it might help with better linearity. What do you think?

I'm looking at single source rail-to-rail op amp circuits, but that's probably not necessary. The photo interrupter should be sensitive enough. I ordered 3 types, with different resolution. Two of them in "slot" design, one very short "distance":
http://www.ges.cz/en/tcst-2103-G...
http://www.ges.cz/en/hint-5200-G...
https://www.ges.cz/en/cny-70-GES...

The last one has sensing distance of 0.3mm, that could be really accurate. Sensing down from above the needle would also eliminate the pennon requirement.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think you made a good choice in the photo interrupters. Because you'll have to some experiments to find out what is a promising approach.

Temperature is a major variable in high precision designs. Temperature influences are found on almost every component in the loop. So each step needs an evaluation of that effect.

Let's take the galvanometer: the coil is made of thin copper wire: temp coëfficient is 0.004 (appr.) So every 2.5 degr C change results in 1% change of the resistance. The force the coil "produces" is proportional to the current through the coil. And with the temp coëfficient in mind we can conclude that a voltage driven galvano is a do-not.
How to compensate for this: use a voltage-to-current converter between the PWM and coil. I am not sure if a current-mirror is the right solution. We'll have to give that some more thought.

The dutycycle of the PWM signal has a high accuracy: the AVR is running from a crystal and digital timers don't drift :) But the AMPLITUDE is a different story: temperature influences the output impedance of the OCnx-pin (=PWM-pin), Vcc will vary, ground @ the galvano-coil is not the same as ground @ the AVR etc.

Assessment of each component in the loop must be done. And after that the complete chain as a whole.

To keep the amplitude of the PWM signal stable over temperature, this may be a good approach: see attached schematic

( I am now looking at a current reference like TL431 and LM234 to see if that catches two flies in one hit )

Attachment(s): 

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I haven't analized this in detail but the general idea of converting PWM percentage to average current is as attached

edit: typo

Attachment(s): 

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

Last Edited: Wed. Sep 14, 2011 - 10:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You're the man! :) Thanks for helping so much. This is awesome. I'd never be able to design something like this.

Some questions:

1) I get the "5V reference with min. temp. coeff" part with LM336 (I found the data sheet). Even though I don't know why LM336 works like that in this setup (I know Zener diode function, but this has 3 terminals and is "configurable"), I trust the docs. But can you explain what R1, R3 and C1 are for? I suspect R1 is to limit the current or create a voltage drop, but that's all.

2) The second circuit I don't understand at all. Could you describe how it works?

Sorry for the dumb questions, but it really helps me in understanding & remembering how current behaves in circuits. I used to solve differential equations for R/C/L loops and compute R/U/I values anywhere in the cicruit (at school), but when I started this project I could hardly remember Ohm's law! Unbelievable.

David

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

According to the datasheet I use (ST = SGS Thomson ), the LM336 is a 2.5V reference. Yes, it is like a zener but adjustable.
R1 limits the current through the "zener", D2, R2 and D3 make it trimmable, but with very low temp drift.
Result: PWM from AVR now generates an AVERAGE voltage that is linear to the dutycycle (PWM percentage) and independent of Vcc or change in output impedance of the AVR PWM output pin.
R3 depends on the instrument, and C1 is to be defined: it averages the voltage across the galvanometer.
But as said earlier: we need to compensate for resistance change (due to temp variations) of the coil in the galvanometer.

The lower circuit uses a constant current chippie: the LM234 f.i. It's "zener for current" instead of voltage. In this circuit, the average current is proportional to the PWM dutycycle, and that's what we are looking for. The circuit is not finished yet. R5 and R6 are spoiling the party a bit. Need some thinking/time to find a better solution to adjust the current. And the circuit around the LM234 needs some more rework.

Tip: www.datasheet.com is a good source for datasheets.

Edit: that second circuit .... the TL341 should be LM234. I will correct that tomorrow in the schematic [ done ]

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, HW is here and I've been hacking on it the whole weekend. :)

Already, I have some results that I'm gonna present here. I've tried two configurations of the galvo connection. One with 200R (10mA) in a series and one with 2R0 (1mA).

For now, it's not mounted on anything and there's no photo-interrupter feedback. I use the serial connection to Arduino to set PWM duty cycle to any value I want and then read the results off the galvo.

I don't have any calibration weights yet, so I use 0.4mm stripped copper wire as a reference. Like this:
PI * (d/2)^2 * 0.00894 * length [units = mm, density = 8.94g/cm^3]
With that I made 3 weights:
3mm = 3.368592mg
10mm = 11.22864mg
20mm = 22.457280mg

The equation checks out, so I was surprised that such a tiny 3mm piece of thin wire would weigh as much as 3mg! But it looks like it's correct, wire is plain Cu and math looks OK to me.

I used super-precise measurements of the wire length and surprisingly enough, the measured values look perfectly linear on the graph. The only issue I have is with 0 (no weight). Check out the calibration graphs:

As you can see, measuring is perfectly linear with my weights, but in both configurations, the "zero" point (empty needle powered so it reads 0) is out. Not by much, but it's there and I don't have small enough weights so as to be able to see how it behaves down there. Perhaps you'll think of something, why it does this.

And finally, some stats. Very precise, but doesn't have much range in the sub-mg area (2k ohm). The galvo is super sensitive, the slightest air flow moves it, but I guess sub-mg weights are so tiny, that even these results are great.

200 ohm (10 mA):
- PWM @ zero = 54 (5%)
- max = 156mg
- resolution = 0.160mg (156 / (1024 - 54))

2k ohm (1 mA):
- PWM @ zero = 347 (33%)
- max = 26mg
- resolution = 0.038mg (26 / (1024 - 347))

To get near 1µg sensitivity, one would have to use a 20k (or 200k) resistor, which would (by extrapolation) give max lift of about 4mg (0.66mg), but you need more than that just to move the needle, so it would be impossible with this particular galvo.

Nevertheless, despite these facts, I'm quite satisfied. Plus, it may be possible my calibration weights are off by order(s) of magnitude :) and in that case all these numbers would shift down and make for a pretty neat 1µg scale. :)

BTW, I use the small galvo from a generic 0-15V panel of about 10x10cm. I removed the fitted resistor to get my own range.

So, to sum up:

1) Can you see why the zero point doesn't fit the linear progression?

2) How do you think the NatSemi guy got so much precision with such a huge galvo? I mean my needle is really a needle, his needle is massive in comparison. The movements on his scale must be invisible by the human eye.

Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
1) Can you see why the zero point doesn't fit the linear progression?
If the galvano you use has bearings (emerald f.i.), their friction will be the highest when starting the movement.

Quote:
2) How do you think the NatSemi guy got so much precision with such a huge galvo? I mean my needle is really a needle, his needle is massive in comparison. The movements on his scale must be invisible by the human eye.
Size says nothing about sensitivity. And you are not using the slot-detector: you use your eyeball to see if the galvo is in zero-position ?
In the old days, with analog instruments, I ticked on the glass to overcome that initial friction. Like one does on a barometer.

I'd love to see some pictures :)

I also wondered about calibration weights: my plan is to take 320mm thin wire, measure it's weight on a 10mg accurate scale, cut the wire in half, than cut one of the halves again etc.

I think that if you use the slot-detector in an analog way, your precision will go up as well.

I have been working on other things in the past days, and interesting enough: I used a Freeduino with a protoshield to test a DDS based on AD9850. I needed a low power (1mA) negative voltage and made the Freeduino do that. But because the layout of the Freeduinoboard I expected troubles ahead, and yes, there was a bear on the road: oscillation due to ground-noise.

PS: DDS = Direct Digital Synthesis

cheers !

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'll reply in depth later tomorrow, I'm driving back to Germany on a project in the morning. I'll be a busy week, but maybe It'll take the Seeeduino with me and experiment after work. If so, I'll take some pictures for you. If not, they'll be available next weekend.

I also connected the detector, but on its own, not via the board. It looks good, I've experimented with different resistors on the transistor emitter and had the most success with 300R. On it, I read 2.9V when the slot is free and 1.2V when the tiny needle passes through in the center-most part.

I've tried larger resistances and with them I got full 5V when free, but the voltage drop was much smaller when the needle passes through. I'm not sure why, guess it has something to do with transistor saturation etc., but the 1.7V drop with 300R should be sufficient to recognize some pretty tiny movements.

The galvanometer is pretty cheap - there is no special bearing, just a coil rotating around its axis, the axis being a needle (sharp on both sides). It's kept in place by two spiral springs (one on each side) that twist in the opposite direction. Inertia doesn't seem to be a problem, but the clearance is. I had to fiddle with how tight the axis needle fits between the bearings and rotate the springs, otherwise when you moved the needle up a lot, it returned slightly higher than it started and the same when moved down. It doesn't return to the exactly same position.

I unscrewed the bearing as much as possible and now it moves freely and the clearance is minimal, but still visible by the naked eye. I guess something much pricier would be required to solve this.

Calibration - I also thought about that. :) But I don't have a sub-g scales, so it wouldn't help me. I found a rather cheap calibration weight set: 1mg - 100g for $47 (class M2, probably). In the E1/E2 class, you pay this much for one piece! :)

You could use these - cheapest I've ever seen, by much! For me, with intl. shipping, they'd cost more than the ones I ordered:
http://www.americanweigh.com/pro...

You must tell me more about the DDS, sounds interesting.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
... but the voltage drop was much smaller when the needle passes through.
No pennon ?

I have been thinking a bit about how to overcome the initial friction: how about adding some noise to the coil-driving signal ? And reduce it over time (1 second or so) to 0 ?

About the DDS: one project at the time, David :) But here a link on what I sorted out. It's in Dutch, but schematics, software en comments in SW are in English: http://www.aplomb.nl/Niels_skn/Niels.html#DDS_AD9850_module

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No pennon at this time. It would be better with, but I need to hang a scoop at the end of the neeedle (like a reverse parachute) and even with the lightest of materials, it's gonna drag it down and lower the max capacity somewhat.

On the other hand, with the pennon, I'd have a clear idea where it is in the slot - voltage ranging from full on to full off. Without it, I need to hunt for the lowest voltage possible, but not really knowing if I'm moving too far down or up. That's rather inconvenient and would have to be solved in SW.

The noise - good idea. The problem is I'm not sure that's gonna help with the "zero/empty" position. In that position, even the slightest PWM +/- moves the correct amount up/down. It doesn't stick. It moves smoothly with or without any load.

I think the non-linearity of this point may be caused purely by physics. I mean when I say that a needle in the horizontal position is "0", I'm actually already pushing some weight - the needle itself (not 0mg).

Then, when I place extra weight at the tip, I'm pushing the needle + the weight, but I also shifted the center of gravity of the combined weight and its weight isn't proportional to the empty needle, because of how lever/fulcrum works.

What do you think? I want to fix this one first and them move on to the interrupter & pennon.

What's weird is that if my theory is correct, the deviation of the empty needle should be consistent, but if you look at those graphs, it's not. First was lighter than the expected linear progression, the second was heavier.

DDS: I see, it's a signal generator, nice. For testing purposes? That's your page you linked here? If so, you've been quite busy I see. :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I think the non-linearity of this point may be caused purely by physics. I mean when I say that a needle in the horizontal position is "0", I'm actually already pushing some weight - the needle itself (not 0mg).

Then, when I place extra weight at the tip, I'm pushing the needle + the weight, but I also shifted the center of gravity of the combined weight and its weight isn't proportional to the empty needle, because of how lever/fulcrum works.

What do you think? I want to fix this one first and them move on to the interrupter & pennon.

I have given it some thought: the center of gravity (CoG) for needle + weight shifts when weight varies. That's correct. But the resulting CoG will always be the sum of the separate CoG's. Vectorwise.

I also believe that there is always an initial friction that needs to be overcome when the needle goes from standstill to a move. But yes, it will be very small ! Otherwise the galvano would be useless for it's purpose.

I did some digging in the attick, ... there must be a galvano there. But cannot find it. Happens more and more. Too much stuff, too slicky memorycells :)

Quote:
DDS: I see, it's a signal generator, nice. For testing purposes? That's your page you linked here? If so, you've been quite busy I see.

I often buy electronics in group-buy-actions. The guy I often buy stuff from has great difficulty with collecting and posting the info. It also happens that it's incomplete or wrong. I can sort most things out myself, but see no reason to keep it TO myself; hence the webpage: now all co-buyers benefit.
The DDS is one of those things where curiosity is the main drive. In that respect I am still very young :lol: But I don't really need it: there is already a (home-built) signal generator on the shelf. And pretty soon it will get company.

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I made some cal weights: silverplated thin copper wire:
960mm weighs 1.12 gram; smallest piece now is 5mm --> 5.83 mg. At least something to start with ;)
I will give it a try with a VU-meter: that's what I could find

Nard

A GIF is worth a thousend words   She is called Rosa, lives at Mint17.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I used a small U meter as well. I don't have enough free time here to continue, so I'll have to experiment later, during the weekend.