Author Topic: Arduino: Cutting the SDA/SCL traces and rerouting them.  (Read 14821 times)

0 Members and 1 Guest are viewing this topic.

Offline gildasdTopic starter

  • Frequent Contributor
  • **
  • Posts: 935
  • Country: be
  • Engineering watch officer - Apprentice Officer
    • Sci-fi Meanderings
Arduino: Cutting the SDA/SCL traces and rerouting them.
« on: May 02, 2016, 10:31:45 pm »
I'm using an Adafruit datalogging shield and need all 6 analogue inputs.
there are multiple "expert" opinions on how to do this: http://forums.adafruit.com/viewtopic.php?f=31&p=277760
But none are really clear. For example, where does one cut the traces? On the Arduino or shield?
The SDA pins (28 and 27) are connected to A4 and A5 on both the Arduino and the shields. This is  very confusing.



Does anybody have guidance on this before I take the cutter to the traces?
« Last Edit: May 02, 2016, 10:57:22 pm by gildasd »
I'm electronically illiterate
 

Offline igendel

  • Frequent Contributor
  • **
  • Posts: 359
  • Country: il
    • It's Every Bit For Itself (Programming & MCU blog)
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #1 on: May 02, 2016, 11:07:33 pm »
What is the point of this "operation"? There must be a smarter way to achieve any goal than to permanently damage the Arduino board.
Maker projects, tutorials etc. on my Youtube channel: https://www.youtube.com/user/idogendel/
 
The following users thanked this post: gildasd

Offline gildasdTopic starter

  • Frequent Contributor
  • **
  • Posts: 935
  • Country: be
  • Engineering watch officer - Apprentice Officer
    • Sci-fi Meanderings
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #2 on: May 02, 2016, 11:12:40 pm »
What is the point of this "operation"? There must be a smarter way to achieve any goal than to permanently damage the Arduino board.
For a unclear reason (legacy probably), the V3 revision of the Arduino still runs the I2C signal (SDA/SCL) via the A4 and A5 analogue input pins.
This means that the write to the SD card, the RTC signal and my analogue sensor (1.5V average) are conflicting.

If I had know about this, I might have gone another route for this project (PI?) but I'm past due on this project and I need to hack a solution out...
I'm electronically illiterate
 

Offline michaeliv

  • Frequent Contributor
  • **
  • Posts: 260
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #3 on: May 02, 2016, 11:18:28 pm »
Why not just cut the header pins that plug into the Arduino, you can re-solder them if you need them at any other time.
Anyway definitely don't cut the tracks on the Arduino otherwise you can't use them, which is exactly what you want to do.
Also do you need the RTC ?
« Last Edit: May 02, 2016, 11:20:07 pm by michaeliv »
 
The following users thanked this post: gildasd

Offline igendel

  • Frequent Contributor
  • **
  • Posts: 359
  • Country: il
    • It's Every Bit For Itself (Programming & MCU blog)
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #4 on: May 02, 2016, 11:28:09 pm »
Well, the connection between the I2C lines and the "analog" pins 4&5 goes all the way back to the micro-controller itself, so no matter what, you won't be able to talk to the RTC and use these pins as analog inputs at the same time.

In the forum discussion you linked to, someone suggested using a "software I2C". In theory that could work (after some delicate re-routing on the shield), but to my humble experience - maybe I'm wrong here - a software-based I2C will probably fail because it can be too demanding for this micro-controller.

I think a better approach will be to find some kind of analog-switch multiplexer IC, that will allow you to select from external analog inputs at will and read them using a single analog pin on the Arduino. Beware though that the IC itself may effect the signal - read the datasheet carefully!
Maker projects, tutorials etc. on my Youtube channel: https://www.youtube.com/user/idogendel/
 
The following users thanked this post: gildasd

Offline gildasdTopic starter

  • Frequent Contributor
  • **
  • Posts: 935
  • Country: be
  • Engineering watch officer - Apprentice Officer
    • Sci-fi Meanderings
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #5 on: May 02, 2016, 11:50:03 pm »
Why not just cut the header pins that plug into the Arduino, you can re-solder them if you need them at any other time.
Anyway definitely don't cut the tracks on the Arduino otherwise you can't use them, which is exactly what you want to do.
Also do you need the RTC ?
I've cut the traces on the shield (not the UNO) and bent the pins out. Nothing I can't fix with some solder...
With this mod and running my standard program, the shield does not hang on SD write any-more, the RTC time is correct on the Excel file.
However the readout of pin a4 and a5 is wrong (1023, that means +VCC).
I need the RTC... But it seems this can be achieved by re-routing the I2C signal with "SoftI2C" to digital pin 4 and 8.

Well, the connection between the I2C lines and the "analog" pins 4&5 goes all the way back to the micro-controller itself, so no matter what, you won't be able to talk to the RTC and use these pins as analog inputs at the same time.

In the forum discussion you linked to, someone suggested using a "software I2C". In theory that could work (after some delicate re-routing on the shield), but to my humble experience - maybe I'm wrong here - a software-based I2C will probably fail because it can be too demanding for this micro-controller.

I think a better approach will be to find some kind of analog-switch multiplexer IC, that will allow you to select from external analog inputs at will and read them using a single analog pin on the Arduino. Beware though that the IC itself may effect the signal - read the datasheet carefully!
I'm not sure about your 1st affirmation, jury is still out!

For the software based I2C, I think I need to be modest in my requests and leave "delay 10" in strategic places to give the ATMEL time to catch up.

If I was to redo this project, I would go the Raspberry Pi with the MCP3008 route. But 6 months ago I knew NOTHING about microcontrollers and chose using datasheets (missing the 6 analogue channels is really 4 marketing bullcrap).

Example of my readout:
millis   stamp         datetime                       temp    wind  cube2 cube3 cube4 cube5  vcc
 999    1462238779    "2016/5/3 1:26:19"   22.19   351   237   473   1023   1023   5.03
1999   1462238780    "2016/5/3 1:26:20"   22.19   327   236   474   1023   1023   5.03
2999   1462238781    "2016/5/3 1:26:21"   22.19   321   243   473   1023   1023   5.03
3999   1462238782    "2016/5/3 1:26:22"   22.19   319   242   475   1023   1023   5.03
4999   1462238783    "2016/5/3 1:26:23"   22.19   317   242   475   1023   1023   5.03
5999   1462238784    "2016/5/3 1:26:24"   22.19   318   244   475   1023   1023   5.03
7000   1462238785    "2016/5/3 1:26:25"   22.19   318   250   475   1023   1023   5.03
8000   1462238786    "2016/5/3 1:26:26"   22.19   315   249   477   1023   1023   5.03
8998   1462238787    "2016/5/3 1:26:27"   22.19   318   251   480   1023   1023   5.03
9999   1462238788    "2016/5/3 1:26:28"   22.19   317   256   480   1023   1023   5.03
« Last Edit: May 02, 2016, 11:54:11 pm by gildasd »
I'm electronically illiterate
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3024
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #6 on: May 02, 2016, 11:52:58 pm »
For a unclear reason

The reason is perfectly clear, it's right there on page 3 of the datasheet...



~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 
The following users thanked this post: gildasd

Offline gildasdTopic starter

  • Frequent Contributor
  • **
  • Posts: 935
  • Country: be
  • Engineering watch officer - Apprentice Officer
    • Sci-fi Meanderings
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #7 on: May 02, 2016, 11:55:33 pm »
For a unclear reason
The reason is perfectly clear, it's right there on page 3 of the datasheet...
That's pretty clear :)
I'm electronically illiterate
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #8 on: May 02, 2016, 11:57:36 pm »
Quote
I'm not sure about your 1st affirmation, jury is still out!

 Jury came in a long time ago. The pins are shared for those analog channels and the two I2C signals. A mega2560 board will solve that pin function conflict.
 
The following users thanked this post: gildasd

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3024
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #9 on: May 03, 2016, 12:02:34 am »
and chose using datasheets (missing the 6 analogue channels is really 4 marketing bullcrap).


If you use a more modern arduino variant which has the 32 pin package QFN/QFP/MLF instead of the 28 pin package DIP, then you get an extra 2 ADC channels, A6 and A7 in Arduino speak.  These are ONLY connected to the ADC, they can't do digitial I/O (nor PWM).  Arduino R3 boards, or at least some copies there of (I don't know about the official one), usually expose these as unpopulated pins somewhere in the middle of the board.
« Last Edit: May 03, 2016, 12:09:52 am by sleemanj »
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 
The following users thanked this post: gildasd

Offline gildasdTopic starter

  • Frequent Contributor
  • **
  • Posts: 935
  • Country: be
  • Engineering watch officer - Apprentice Officer
    • Sci-fi Meanderings
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #10 on: May 03, 2016, 12:05:25 am »
Quote
I'm not sure about your 1st affirmation, jury is still out!

 Jury came in a long time ago. The pins are shared for those analog channels and the two I2C signals. A mega2560 board will solve that pin function conflict.
The MEGA route is obvious now, but I had insufficient knowledge when I started to choose it. It's too late to change.
Hence it's "bodging time"...

and chose using datasheets (missing the 6 analogue channels is really 4 marketing bullcrap).

If you use a more modern arduino variant which has the 32 pin package QFN/QFP/MLF instead of the 28 pin package DIP, then you get an extra 2 ADC channels, A6 and A7 in Arduino speak.  These are ONLY connected to the ADC, they can't do digitial I/O (nor PWM).  Arduino R3 boards, or copies there of, usually expose these as unpopulated pins somewhere in the middle of the board.
Darn, that seems to be the case on the MICRO, not on the full size UNO... Too late sadly!
« Last Edit: May 03, 2016, 12:14:26 am by gildasd »
I'm electronically illiterate
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #11 on: May 03, 2016, 12:10:38 am »
Quote
I'm not sure about your 1st affirmation, jury is still out!

 Jury came in a long time ago. The pins are shared for those analog channels and the two I2C signals. A mega2560 board will solve that pin function conflict.
The MEGA route is obvious now, but I had insufficient knowledge when I started to choose. It's too late to change.
Hence it's "bodging time"...

 Roger that, you do what you have to do.  :-+

With Asian mega2560 boards available for under $10 I would think the it a better 'starting board' then the Uno.

http://www.ebay.com/itm/Keyes-ATMega2560-16AU-CH340-Mega-2560-R3-Controller-board-for-Arduino-/131679238724?hash=item1ea8b1ba44:g:OKsAAOSwYaFWc3dF
 
The following users thanked this post: gildasd

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3024
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #12 on: May 03, 2016, 12:12:33 am »
Darn, that seems to be the case on the MICRO, not on the full size UNO... Too late sadly!

Wouldn't surprise me if the official arduino R3 doesn't have them broken out.  But various clones from the usual places do...



of course, no good if you are in a hurry to do your project.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 
The following users thanked this post: gildasd

Offline igendel

  • Frequent Contributor
  • **
  • Posts: 359
  • Country: il
    • It's Every Bit For Itself (Programming & MCU blog)
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #13 on: May 03, 2016, 12:15:29 am »
If you use a more modern arduino variant which has the 32 pin package QFN/QFP/MLF instead of the 28 pin package DIP, then you get an extra 2 ADC channels, A6 and A7 in Arduino speak.  These are ONLY connected to the ADC, they can't do digitial I/O (nor PWM).  Arduino R3 boards, or at least some copies there of (I don't know about the official one), usually expose these as unpopulated pins somewhere in the middle of the board.

A6 and A7 pins exist on variants such as the Arduino Pro Mini, but are pretty rare on a shield-compatible boards (the yellow board in the picture is actually the first time I see them!)
Maker projects, tutorials etc. on my Youtube channel: https://www.youtube.com/user/idogendel/
 

Offline gildasdTopic starter

  • Frequent Contributor
  • **
  • Posts: 935
  • Country: be
  • Engineering watch officer - Apprentice Officer
    • Sci-fi Meanderings
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #14 on: May 03, 2016, 12:21:58 am »
Darn, that seems to be the case on the MICRO, not on the full size UNO... Too late sadly!
Wouldn't surprise me if the official arduino R3 doesn't have them broken out.  But various clones from the usual places do...
of course, no good if you are in a hurry to do your project.
I'm wary about clones, this is for a Uni project, and some of professors can give you a hard time with non OEM stuff because of intellectual property brouhaha...
So an non Arduino made Arduino asking for trouble and would need 10 pages of explanation on open source hardware etc.
For example, my software list only includes open source (KIcad, Libreoffice etc) to avoid having to provide serial numbers.
« Last Edit: May 03, 2016, 12:25:38 am by gildasd »
I'm electronically illiterate
 

Offline gildasdTopic starter

  • Frequent Contributor
  • **
  • Posts: 935
  • Country: be
  • Engineering watch officer - Apprentice Officer
    • Sci-fi Meanderings
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #15 on: May 03, 2016, 12:58:06 am »
If you use a more modern arduino variant which has the 32 pin package QFN/QFP/MLF instead of the 28 pin package DIP, then you get an extra 2 ADC channels, A6 and A7 in Arduino speak.  These are ONLY connected to the ADC, they can't do digitial I/O (nor PWM).  Arduino R3 boards, or at least some copies there of (I don't know about the official one), usually expose these as unpopulated pins somewhere in the middle of the board.

A6 and A7 pins exist on variants such as the Arduino Pro Mini, but are pretty rare on a shield-compatible boards (the yellow board in the picture is actually the first time I see them!)

Found on http://www.arduino.cc/en/Reference/PortManipulation:

PORTC maps to Arduino analog pins 0 to 5. Pins 6 & 7 are only accessible on the Arduino Mini

    DDRC - The Port C Data Direction Register - read/write
    PORTC - The Port C Data Register - read/write
    PINC - The Port C Input Pins Register - read only
I'm electronically illiterate
 

Offline gildasdTopic starter

  • Frequent Contributor
  • **
  • Posts: 935
  • Country: be
  • Engineering watch officer - Apprentice Officer
    • Sci-fi Meanderings
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #16 on: May 03, 2016, 01:11:47 am »
Working on trying to reroute the SDA/SCL via SoftI2Cmaster.
THe shield traces are cut and, the pins bent, new two pin header on the SDA/SCL contacts on the shield.
Trying to use digital pin 2 (pcint18) and 8 (pcint0):

Code: [Select]
#include "RTClib.h"
#define SCL_PIN 2
#define SCL_PORT PORTD
#define SDA_PIN 7
#define SDA_PORT PORTB
#include <SoftI2CMaster.h>
No errors so far!
I'm electronically illiterate
 

Offline gildasdTopic starter

  • Frequent Contributor
  • **
  • Posts: 935
  • Country: be
  • Engineering watch officer - Apprentice Officer
    • Sci-fi Meanderings
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #17 on: May 03, 2016, 03:50:24 am »
Giving up...
The vaunted 6 analogue inputs are pure marketing (a lie) and I can't do anything about it.
Luckily my sensors are "push pull" so I can interpolate from two in a cross.
But I lose the averaging out and some data quality of having 4.

Pissed off at having been "marketed" at by Arduino and Adafruit.
It's duckling stupid, I would have simple gone the MEGA or MINI route from the start had they not "marketed".
I'm electronically illiterate
 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #18 on: May 03, 2016, 05:39:00 am »
I'm not a big fan of how Arduino has handled the explosion of 'vague' information, but you may find some ideas  on remapping the pins you're using in the pins.arduino.h (header) file - to remap the pin assignments of your 'standard' Arduino board...

C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard
There are \folders for all the other standard Arduino boards - one level up.
Don't ask a question if you aren't willing to listen to the answer.
 
The following users thanked this post: gildasd

Offline gildasdTopic starter

  • Frequent Contributor
  • **
  • Posts: 935
  • Country: be
  • Engineering watch officer - Apprentice Officer
    • Sci-fi Meanderings
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #19 on: May 03, 2016, 07:35:37 am »
I'm not a big fan of how Arduino has handled the explosion of 'vague' information, but you may find some ideas  on remapping the pins you're using in the pins.arduino.h (header) file - to remap the pin assignments of your 'standard' Arduino board...

C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard
There are \folders for all the other standard Arduino boards - one level up.
If I did that, would the header shield not be lost about what pin does what?
« Last Edit: May 03, 2016, 08:38:10 am by gildasd »
I'm electronically illiterate
 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #20 on: May 03, 2016, 07:43:57 am »
No... the header specifies the pin assignments wrt the pin 'names', so you can move things around quite a bit.  Many pins are multi-purpose, and the Arduino default is to expose the most likely combination of functions for hobbyists.
I'm certainly no expert, but there are a couple of other files in the \hardware\avr branch that I've used some time ago, which manipulate the breakout of functions for the different chips and board layouts.

For more accurate info, it may be worth googling Arduino pin function mapping...
Don't ask a question if you aren't willing to listen to the answer.
 
The following users thanked this post: gildasd

Offline gildasdTopic starter

  • Frequent Contributor
  • **
  • Posts: 935
  • Country: be
  • Engineering watch officer - Apprentice Officer
    • Sci-fi Meanderings
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #21 on: May 03, 2016, 08:32:21 am »
No... the header specifies the pin assignments wrt the pin 'names', so you can move things around quite a bit.  Many pins are multi-purpose, and the Arduino default is to expose the most likely combination of functions for hobbyists.
I'm certainly no expert, but there are a couple of other files in the \hardware\avr branch that I've used some time ago, which manipulate the breakout of functions for the different chips and board layouts.

For more accurate info, it may be worth googling Arduino pin function mapping...
Mistyped, not the header, the datalogging shield that I slap on top, it's waiting for I2C via a4 and a5.
I'm electronically illiterate
 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #22 on: May 03, 2016, 08:38:45 am »
If you're not keen on looking at function reassignment on the Arduino, then a soft implementation of I2C is fairly trivial (many references in C online), and will solve your conflict easily on any spare digital pins. 
Don't forget the 4K7 pull-ups for the second I2C buss !
Don't ask a question if you aren't willing to listen to the answer.
 
The following users thanked this post: gildasd

Offline gildasdTopic starter

  • Frequent Contributor
  • **
  • Posts: 935
  • Country: be
  • Engineering watch officer - Apprentice Officer
    • Sci-fi Meanderings
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #23 on: May 03, 2016, 09:09:55 am »
If you're not keen on looking at function reassignment on the Arduino, then a soft implementation of I2C is fairly trivial (many references in C online), and will solve your conflict easily on any spare digital pins. 
Don't forget the 4K7 pull-ups for the second I2C buss !
Can you recommend a thread/page? I've been sifting through a lot and most of what I've read seems to typed by code butchers that don't get around to finishing it...
And the butcher has 1000 cousins that all have variations that all are incomplete.
I'm not asking you do anything more than to indicate what cliff I should jump off  ;D
I'm electronically illiterate
 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: Arduino: Cutting the SDA/SCL traces and rerouting them.
« Reply #24 on: May 03, 2016, 09:22:38 am »
The library you mentioned earlier looks pretty good, and is designed for the Arduino...
http://playground.arduino.cc/Main/SoftwareI2CLibrary

The example down the bottom of that link tells you most you need to know to get started...
Once you get that inline with your code, change the I2C address to that for your shield, and rename the BMAxxx to whatever you like for your device.
Of course the specific read & write functions are specific to your device and functions required in your program.
Don't ask a question if you aren't willing to listen to the answer.
 
The following users thanked this post: gildasd


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf