Saturday, June 25, 2016

Copy and paste from one ExpressPCB file to another

[I have originally posted this to the PCB workshop FAQ.]

"Is it possible to copy and paste from one ExpressPCB file (schematic or layout) to another?"  I get this question once in a while.

Yes, copying and pasting between ExpressPCB files is possible.  It's just less intuitive, compared to what we are used to.  You can't open 2 separate instances of ExpressPCB and copy from one to another.  The workaround is to copy and paste within the same instance of ExpressPCB.
  1. Open the file which you want to copy from.
  2. Select the content that you want to copy, and copy it (press Ctrl+C).
  3. In the same instance of ExpressPCB open the file that you wan to copy to. (Or create a new file, to copy to.) It's important that you don't close this instance of ExpressPCB between copying and pasting.
  4. Paste the content (press Ctrl+V). The pasted content will remain selected. Move it to desired position. Done.
These steps were tested in version 7.3.5 of ExpressPCB and ExpressSCH.

Wednesday, May 4, 2016

Hacker Dojo had dumped its library. Alas, literally.

Dumpster in the Hacker Dojo's parking lot.
One of the Hacker Dojo's appeals was its library.  Unfortunately it got disposed of in the least sophisticated way.

There was a good number of classical books on engineering and software development there.  I've found Code Complete 2 and several Martin Fowler's books in Hacker Dojo's library.  I've added a few of my own books.  A few books I've put on my reading list, but didn't see them again (somebody got to them before me).
About a half of the dumpster is books from Hacker Dojo's library.
Other books were largely outdated.  Not many folks would want to read Flickr Hacks (2006) or Programming Windows 3.1 (1992).
I'm aware that a library is a bit of a white elephant, when it comes to moving.  Nevertheless, there were better options than a dumpster.
  • Post a message on Google group, Facebook, Twitter, and such.  There are people who love books and know what to do with them.  They could take them home, then bring them back to the new Hacker Dojo location.
  • There are plenty of ad hoc book exchange cabinets at local coffee shops.
  • Public libraries accept book donations.  They either add books to their inventory, or sell them.
  • Set the book shelves outside.  That gives folks some time to browse and pick out valuable ones.  That's still a smarter option than a dumpster.
I have picked out a trunkfull, and donated most of them to Redwood City library.  I'll read a couple first before donating.

By the way, during the previous move (from Whisman to Fairchild), the library was preserved.

Friday, January 29, 2016

Teardown of Fluke 52 II thermocouple thermometer

A small board responsible for cold-junction compensation (CJC) during thermocouple measurement is a curious part of this thermometer.  Have you ever designed cold-junction compensation for a thermocouple front end?  Let's see how Fluke did it.

Main board is visible.


Progressively removing the case. The cold-junction compensation board is not yet visible. It sits below the main board and behind the black plastic plate with slots for thermocouple connector blades.
The cold-junction compensation board sits below the main board.  The contact between the pads and thermocouple connector blades forms the cold junctions, which the instrument has to compensate for.  Since cold-junction compensation has its own daughter board, and it's somewhat  insulated from temperature gradients that may be generated by the main board.


Interestingly, the CJC board is made with metal (copper) substrate.  It promotes heat transfer and reduces temperature gradient between the cold junctions and the sensor which measures their temperature.  (The CJC temperature sensors are better visible on another photo below.)

Side view.

Thermocouple connector added to show where the contact between thermocouple materials and copper pads on the cold-junction compensation board takes place.

Cold-junction compensation sits on its own daughter board, and it's somewhat insulated from temperature gradients that may be generated by the main board. 

CJC board. Temperature sensors visible. Thermocouple plug added to the picture to show where blades make contact.
Main view of the cold-junction compensation board.
  • SOT-23-3 ICs between each pair of the thermocouple pads are the sensors which measure the cold-junction temperature.
  • An EEPROM (AT25010 ) suggests that the CJC board is calibrated separately from the main board and the coefficients are stored in this EEPROM.
  • LT1034 is a dual voltage reference

Each blade of a thermocouple plug has an individual spring clip that presses the blade to the contact pad on the board.

Related

Maxim App Note 4026  Implementing Cold-Junction Compensation in Thermocouple Applications
Discussion about cold-junction compensation in this Analog Dialogue article (2010).

Sunday, October 18, 2015

I2C pull-up resistors on modules and breakout boards

Some of the modules and breakout boards for I2C slave devices contain I2C pull-up resistors. When multiple such modules are connected to the same I2C bus, their pull-up resistors appear in parallel.  That results in a stronger effective pull-up resistance, which may prevent communication on the I2C bus.

You have to have pull-ups on the I2C bus.

Somewhere on the  I2C bus you have to have pull-ups in order to be able to communicate on the I2C bus.  The pull-ups may reside on the microcontroller board, or on the I2C slave device's breakout board, or anywhere else on the I2C bus.

Some microcontrollers have internal pull-ups.  It's not recommended to use the microcontroller's internal pull-ups for I2C.  Still, internal pull-ups is much better than no pull-ups at all.

Watch out, though.  It's possible to end-up with pull-up that's too strong.

If pull-up resistors are too strong, that can prevent communication on the I2C bus.

Strong pull-up means that the current through the resistor is relatively large.  Stronger pull-up translates into smaller resistor value.  Weak  pull-up translates into a larger resistor value. 
(Stiff means the same as strong, when describing pull-up resistors.  This terminology is not limited to I2C.  It applies to pull-up and pull-down resistors in other types of circuits too.)

The unwanted pull-up resistors are shown in red.  These may create a pull-up that's too strong, which can prevent the communication on the I2C bus.

Suppose all three boards in this diagram came with pull-up resistors installed. The 2.2 kΩ value is common for an I2C bus running at +5V.  Notice however that R2, R4, R6 all are connected between SCL and Vdd.  They are in parallel, and they act as one 733 Ω resistor.  This combined pull-up is too strong I2C.  That can prevent communication on the I2C bus.  (Similar for the pull-up resistors on the SDA line.)

If these resistors can spoil the I2C bus, then why are they designed into the breakout boards in the first place?  I'm guessing that it must have been a compromise to create an easy out-of-the-box experience.  A lot of I2C first-timers don't know that pull-ups are required.  Some Arduino boards don't have I2C pull-up resistors nor pads for them (Arduino Uno, Arduino Pro, for example).  Some Arduino boards have unpopulated pads for I2C pull-up resistors (Arduino Mini Pro, for example).  A breakout board provides the pull-ups, and "it just works".  That is, until too many breakout boards are connected in parallel.

Remedies

Of course, as soon as you realize that there are extra pull-up resistors you can simply remove them.

Some breakout board suppliers are aware of the possible parallel pull-up scenario.  Many of the newer breakout boards have been designed with that in mind.
  • Perhaps to partially address this, some of the breakout boards have I2C pull-ups which are half strength.  They are weaker than the correct values for the I2C, but stronger than the internal pull-ups of a μC.  A typical such value is 4.7 kΩ .  This is a compromise.  The number of modules that can be connected in parallel without removing resistors is still limited. But a greater number of modules may be connected before combined parallel pull-up becomes too strong.
  • On some of the breakout boards, pull-up resistors are connected to Vcc through solder blobs.  A solder blob is easy to remove, then pull-up resistors will not affect the I2C bus.  (For example, see SJ1 in this SparkFun breakout board.)
  • Some breakout boards have unpopulated pads for pull-ups.  (For example, see R1 and R2 on this board.)

Related

I2C bus specification and user manual.  Anyone working with I2C should at least skim through it.
How to deal with multiple pull-up resistors on modules?  That forum question was a point of departure for writing this post.
A case when ATmega's internal pull-ups were used for I2C.  The oscilloscope screenshots show I2C waveforms with internal pull-ups and proper pull-up resistors.
Forum thread Is there a correct resistance value for I2C pull-up resistors? and application note I2C Bus Pullup Resistor Calculation.
EDN article Design calculations for robust I2C communications.  Concise article with diagrams showing I2C physical layer principles of operation.

Friday, August 14, 2015

When does the Arduino Wire library actually transmit on I2C ?

I wanted to better understand the inner workings of the Wire library (the I2C library that comes with Arduino IDE).  The detailed reference and source code were helpful.  To check my understanding, I made a simple oscilloscope experiment, which I would like to report in this post.

Setup

Straightforward test code, which creates a write transaction on the I2C bus.  To know when the calls to the Wire library methods happen, each one is preceded by a strobe on pin 13.  These strobes will be seen with an oscilloscope.   To know when the I2C activity actually occurs, SDA and SCL (the I2C data and clock lines) are too observed with the oscilloscope.

  void strobe() {
    digitalWrite(13, HIGH);           // Strobe for oscilloscope
    digitalWrite(13, LOW);
  }
 
  void loop() {
    strobe();
    Wire.beginTransmission(0x4C);     // Set the address of the target device  
                                      // which we want to write to
    strobe();
    Wire.write(0x07);                 // Payload: set the address of the register inside
                                      // of the external device, which we want to write to
    strobe();
    Wire.write(0x01);                 // Payload: value to write to the register

    strobe();
    Wire.endTransmission();           // Actually do the transmission.

    delay(1000);
  }

This code ran on Arduino LilyPad USB (my clone thereof).  It should work the same on any Arduino that's based on AVR and has got hardware I2C.

(The addressee of this I2C transaction is an MMA7660 accelerometer.  It could have been just about any I2C slave device.)

Results and discussion

Debug strobes and the I2C activity.  All I2C activity takes place after the strobes.

As you can see, all of the I2C activity happens after all the calls to the Wire library methods have been made.
Wire.beginTransmission(...) doesn't actually begin the transmission, it only sets the I2C slave address for the forthcoming transmission.
Wire.write(...) doesn't actually transmit, it writes to a buffer in the Arduino's RAM.
Wire.endTransmission() actually causes the whole I2C transaction to happen from beginning to end.

Perhaps, the Wire Library functions could have names that better reflects inner workings.

References

[1]  Wire Library superficial reference
[2]  Wire Library detailed reference
[3]  Source code for Wire Library on GitHub

Saturday, June 27, 2015

Teardown of Mastech MS8268 multimeter


The advertising for this multimeter stated that it has "warning when incorrect banana jacks are used relative to function switch setting".  I got curious about how the meter detected the banana plugs.  At first, I thought that there is an optical proximity sensors under each jacks, but that was an incorrect guess.  Each jack has a momentary switch at the bottom.  The switch has an plastic plunger, which insulates the detection switch from the banana contacts.



Light pipes for ring indicators around banana jacks visible.
One of the light pipes, which forms the ring around a banana jack, is removed and shown separately on the right.
Red and black plastic parts inside of the banana jacks are the plungers which activate the detection switches.
The IC in the middle is a PIC microcontroller.  I suspect that it's main purpose is to detect leads, and to control the LEDs under the light pipes.

Mastech MS8268 multimeter with back cover removed. Fuse visible.



ICs in this meter, which I was able to identify
I bought this MS8268 multimeter to measure low currents on the order of units of microamps.  The miltimeter didn't disappoint, considering especially a relatively low price.

Related

Mastech MS8268 review

Thursday, June 11, 2015

Teardown of a paddle wheel flow meter

I'm setting up a control system for a small scale biofuel processing rig. Part of the task is to monitor the flow rate of feedstock. Due to budget constraints, I could not simply buy and industrial grade sensor. So, I'm evaluating this low cost sensor for low flow rate and more viscous fluid [than water].

This type of low-cost paddle wheel flow meter is sold by Adafruit among other places.

Assembled flow sensor before teardown

Cavity is open.  Top of the paddle wheel with the magnet visible inside the cavity.
The gap between the tips of the paddles and the cavity is about 2.5mm .  If the gap were smaller, this flow meter would be more sensitive at low speeds.

The static o-ring, which seals the paddle wheel cavity, is visible on the lid.  The latter also serves as the bottom of the PCB compartment.

At the end of the paddle wheel sits the magnet.  The outside diameter of the magnet is 9.7mm .

PCB compartment is open.  Component side of the PCB visible.

PCB with Hall effect sensor removed from its compartment

On the left side of the PCB stands the Hall effect sensor.  The writing on the IC is "W130".  I'm guessing it's Winson WSH130 (datasheet).  The Hall effect sensor sits 16.4mm from the axis.

The o-ring in this photo prevents liquid ingress into PCB compartment.  This is the 2nd o-ring in this device, and not the main one that seals the paddle cavity.

Reassembly

After this teardown, the reassembled sensor continued to work like new. 

Related

Sensors Magazine article on paddlewheel flow sensors
Higher precision paddle wheel flow sensors made by Omega Engineering

Disclaimer

I'm not affiliated with any of the companies mentioned in this post.