I have two sensors from Adafruit, SI1145 and MPL3115A2. I’d like to use them simultaneously, but they have the same I2C address of 0x60, which are apparently not able to be changed. Are there any reasonable workarounds besides using another Core?
One option is to connect the Vin for each device to a digital I/O device, so you only power it up when you want to access it. Another option is to use something like a 4066 Quad Bilateral Switch on the SDA line to switch between devices. This would allow both to be constantly powered up which might be a good thing for the devices.
@wgbartley, you would think that I2C device makers would allow for some address programming! @vk2tds is correct regarding using a 4066 on the SDA line and leaving the SCK line connected to both. This allows both to be powered and clocked but only one is being communicated with. However, some I2C slave devices can do clock stretching so SCK may need to be gated as well. Trying out the SDA line only will tell you everything you need to know.
Estimated delivery date is June 5. Got 5 for $3.19 with free shipping on eBay … from Colorado!
However, I do still like the duct tape method of just toggling them on and off using one of the digital pins. On a semi-similar note, is that a good way to power down devices when they aren’t in use? I’m still doing uptime tests on some Cores (24+ hours and I still see lights blinking every few minutes!), but they don’t have anything else running on them. I know the GPIO pins are limited to a certain load, but if the load of the sensors is within bound, can they be toggled on and off that way? Or is that another use for transistors? (I hadn’t used a transistor to toggle a load until I used the NPN one in the Maker Kit to play with the little motor.)
According to table 7 of https://github.com/spark/core/blob/master/Datasheets/ST_STM32F103CB.pdf, all the I/O pins can supply up to 25 mA. The Altimeter chip consumes no more than 2mA, plus whatever else is on the board, so it should be fine. The light chip pulls a maximum of 5.5 mA, which is fine too.
Start using some of the other functions on the boards other than the pure chip and you might need to manage energy consumption more carefully. Attaching devices like this can be very useful. I did it with a GPRS based GPS tracker, and would turn the GPRS off if it got confused. Sometimes it is the best way to reset stuff.
Just ask Microsoft about that one . . .
Hey there @wgbartley. I have been having a lot of trouble getting the MPL3115A2 to work with just the Core. In the serial out, I am getting some really weird numbers (way to high) for elevation, temp, etc. They stay the same every time and even after restarting. I was thinking it was a hardware problem so I went as far as to order another from Adafruit but I got the same thing. Could you by chance show me how you wired it up to the Core? Did you use pull-up resistors. Also what does your code look like. I am rather new to this hobby and any help from anyone else is greatly appreciated.
how are you wiring up now?
I’ve tried it both of these ways.
Ah ha! I know why now…
Looking at the description (http://www.adafruit.com/product/1893), This particular board is having an onboard regulator @ 3.0V + level shifting to talk between the Arduino and the board itself.
i.e to say is that the Vin required +5V and since D0 and D1 are 5V tolerant pins, you can safely connect SCL and SDA to the core without damaging it
I would definitely not recommend doing so for long term as that might be a little risky pushing the tolerant capability but for testing…just do it!
So basically, use Vin core to Vin shield instead of 3.3V core to Vin shield.
Wondering if @wgbartley did the same thing!
@kennethlimcp, I thought the vin on the core was for powering it using something other than the USB power. Am I wrong here? Also, should I go with the pull-up resistor setup or without?
I think keeping the Pull-up resistors for now is safe just to make sure you can communicate with it.
The name Vin doesn’t sound intuitive for sure but there’s a diode from the 5V USB to the Vin port. So what happens when you power through USB is that…there’s actually around 4.7V (i think) after the voltage drop across the diode.
In that way, you can actually use it as sort of a 5v pin! Don’t believe me for this. Measure yourself!
Thanks for the help @kennethlimcp. I had been using that vin pin before for powering the Core as later on I plan on to be powering it from a different source instead of the USB. If what I need is 5v to the vin on the altimeter, I can get that from the other source. Is the only thing I was doing wrong before was that the shield was getting 3.3v rather than needing 5v?
I think so. At least, that’s what i figured out after reading the description a couple of time.
No harm testing and i’m sure it won’t be damaged with 5V on Vin
If it works well using 5V on Vin, you can then attempting to remove the Pull-up. I can’t tell if pull-up is populated on the breakout board since the schematic doesn’t seem to be available!
Wow thank you so much!! I already have it up in running after hours of hair-pulling to no avail. Its exciting to finally see it work as intended!
What happens with the pull-up resistors removed?
I’m testing it right now with out any and it seems to be working great. I’m wondering if accuracy would have anything to do with whether they were present or not.
I don’t think so since pull-ups are used for the communication but @bko can comment on this
No, the resistors are required for any i2c operation so they must be built-in to the board. Many of the (excellent) Adafruit products have them built-in, but this one just says it has a level-shifter since the device is a 3.3V device but the board is built for +5V Arduinos. It would actually be nice if there was 3.3V break-out board since you could just tie the MPL3115A2 and Spark together directly.