Can't retrieve data from BMP180 using BLE112 via I2C - bluetooth-lowenergy

I'm trying to read temperature data from BMP180 using my BLE112 via I2C. The problem is that what get in the very end are some unrelevant numbers. I think i am missing something extremely important. I follow BMP180 datasheet point by point. Program that i have is wrote in BGScript from Bluegiga
There are few things that are strange in my opinion:
measuring raw temperature (even though is not correct) sometimes gives 0.. So how slow is this programmable I2C?
http://www.sureshjoshi.com/embedded/ble112-how-to-use-i2c/ Suresh Joshi writes here that register i should write and read in is the one from datasheet left shifted once. Is it necessary also in my case?
can someone verify these staps of algorithm:
a) reading calibrations: call hardware_i2c_read(238,0,"\xaa")(result,data_len,sensor(0:22)) - should i write something before?
b) write 0x2E into reg 0xF4 should it be : call hardware_i2c_write(238,1,2,"\xf4\x2e")(written) ?
c) read reg 0xF6(MSB) and 0xF7(LSB) should it be call hardware_i2c_read(239,0,"\xf6")(result,data_len, MSB) and call hardware_i2c_read(239,0,"\xf7")(result,data_len,LSB)
I am struggling so hard so if anyone could tell me what is wrong or if i can't use this sensor with this BLE module please tell me! (:
My .bgs file : http://pastebin.com/3zHVdNrT
BR Bartek

Related

Node Red NMEA node not accepting GPS information from Arduino Serial

Hope you are having a nice day.
My issue is related to a NMEA node not acting properly when I send it GPS information received from an Arduino or Inject function.
It is being sent via serial and has supposedly the correct format.
I tried the same using a VK-162 (USB GPS) and it is working well.
But when I try to send a message with a format like:
$GPGLL,4916.45,N,12311.12,W,225444,A
or with the Arduino, I get the following in my debug area:
If someone could give me some insight I would greatly appreciate it :)
All the best.
It looks like you are missing a checksum from the end of the line
All of the following work
$GPGLL,4916.45,N,12311.12,W,225444,A*31
$GPGLL,5133.81,N,00042.25,W*75
$GPGLL,3751.65,S,14507.36,E*77
(checksum calculated with https://nmeachecksum.eqth.net/)

I2C between EEPROM and Arduino working, not with STM32

This is driving me nuts for a couple of days now, so maybe you guys can give me some insights into what is going wrong.
I'm trying to read some data from an EEPROM (24LC16B) with an STM32(F0), but it just doesn't let me. I've tried an Arduino, which worked and does still work, so I do know that the wiring is correct.
This is my function to read the EEPROM data. (It is cut down to the very basis, just for testing): (Pastebin of my I2C_setup function)
uint16_t readEEPROMData(uint16_t deviceAddress, int memAddress){
// Wait while I2C peripheral is not ready
I2C_WaitForFlag(I2C_ISR_BUSY);
// Start I2C write transfer for 2 bytes, do not end transfer (SoftEnd_Mode)
I2C_TransferHandling(I2C1, 0xA2, 2, I2C_SoftEnd_Mode, I2C_Generate_Start_Write);
I2C_WaitForFlag(I2C_ISR_TXIS);
// For testing purpose, be sure to generate a stop command...
I2C_TransferHandling(I2C1, 0xA2, 0, I2C_AutoEnd_Mode, I2C_Generate_Stop);
return I2C_COMM_STATUS;
}
Here's an pastebin of the Arduino library I used.
I've used a logic analyzer to see how the communication is going, and now I really don't understand it. Here's a printscreen of the working Arduino version:
And here's a printscreen of the STM32 communication:
Logic analyzer exports (viewable with Saleae Logic)
As you can see, I'm using the same address (although I had to use 0xA2 with the STM32), and there are no weird things happening, besides the NACK. So what could possible be wrong?
Confirm if all bus timing requirement are satisfied.
Confirm if their is adequate delay after every write cycle (5 mS)
Confirm is bus capacitance falls under permissible limit of I2C (400 pF - Theoretically).
Confirm if the correct VCC is supplied
As mentioned by you are interfacing EEPROM with MCU using cable you need to conform on capacitance.
You can use an oscilloscope to check if their are any distortion in waveform. You can use a LCR meter to check the capacitance.
Try reducing bus speed 25kHz to 50 kHz and check waveform.
Try increasing the strength of pull resister.
The problem with the wrong VCC capacity (4.2v instead of 5v for example) is, that the timing can be different to. (not fully verified, but it fixed the problem)

Better/faster way to read from Serial1 in Arduino Lonardo?

I would be interested on knowing the faster or better way to read the reply to a command that I send towards one of my serial interfaces (Serial1 in Lonardo platform). So far I have been using as beneath, is there any other better way to read the output from that Serial1?
Thanks in advance,
regards
Serial1.print(dataToBeTx);
Serial.print(text + dataToBeTx);
delay(4000);
while (Serial1.available()) Serial.write(Serial1.read());
There's a couple different ways you could handle this, both allowing you to avoid a long delay(XXXX) statement. These two, in my experience, are generally the most common, both allowing you to continue executing code when the expected data is received, instead of delaying.
Using Arduino's SerialEvent API, which is called when new serial data is ready. You could then determine what to do with the received data.
Using the Serial1.readBytes call, which allows you to specify a set amount of bytes to read, and combined with Serial1.setTimeout allow you to set a maximum time to wait for those bytes, in case serial data is not received.

arduino (mega 2560) to graph numbers

i am currently studying 3rd year CSE and have little to no background in electronics but i have suddenly taken an interest in robotics
i just started using arduino and its exciting. i got a bit of understanding of to code it (i know c and java). unfortunately i am lost when it comes to interfacing it with anything else other than arduino software. my teacher gave me a project to do as a begineer.
MY QUESTION: i was told to send a number (or sequence of numbers) to the arduino board. the board should blink the pin 13 LED (i know how to do this part) when it receives a number. then it should divide the number by two and send the result back to computer. here the computer must use "processing tool" to graph the number.
1. any help/hints are appreciated.
2. any idea on what this "processing tool" is actually called? all i was told was it was a software to graph numbers.
3. how to take output from arduino into another program as input?
thanks in advance
The processing tool is literally called Processing. It is a Java-based programmatic screen-drawing system that is very easy to use. Take a look at it here.
Processing is much like Arduino in that it has the setup(), loop() architecture and is similar in syntax.
To get data from the Arduino to Processing, you will need to send serial data to the PC.

Sending output from arduino to picaxe

I am doing a class project involving an Arduino Uno and a Picaxe 14m2.
I am in the middle of attempting to code a program for the Arduino Uno that will allow me to send and output value to the input on the Picaxe.
So in layman's, this is what I wish to achieve:
I want the Arduino to check a sensor, and if the sensor returns a specific value. (- I know this part, but not the next.) I then want the Arduino to send a value (HIGH, or 1 .. something like that) as an output to one of the Picaxe input pins. I then need the Picaxe to notice a value has been sent, and then do something else.
Any help would be appreciated.
Thanks.
If you are looking for that, you may want to specify what kind of PICAXE you have.
Since there is a difference in the types of these chips.
After that you may wanna look over the datasheet of the PICAXE so that you can find the instructions set and the type of program memory you have, "EEPROM....".
After that:
List your Is/Os, inputs and outputs.
Set your source code editor.
Write the source code and burn it to the PICAXE program
memory.(C, Assembly...)
Write your Arduino code, setting the Is/Os and telling the
Arduino how to deal with the signals in and out.(C language)
Make a circuit diagram for the hardware you are going to connect
between both chips.
Don't forget to see the loading effects on both the Arduino and
the PICAXE, because you don't want to burn your project hardware
after all.
Test your project and note that you will have to troubleshoot
both software and hardware whenever a problem occurs.
I suggest that you use the Oscilloscope to test the signals going in or coming out of both circuits + the sensor's signal.
For any extra thing you need the PICAXE to do, use If statements, because they are not so technical to implement and they are easy to write and troubleshoot.
For your scheme, you are actually making the Arduino give instructions to the PICAXE through a variable signal coming from a sensor.
^send me feedback and I will help more.
You will probably want to look into using UART (aka Serial) or i2c communication.
Serial communication should work with any PICAXE and Arduino, While i2c Will only work if you are using the X2 Series PICAXE Chips. i2c's main advantage is when using multiple slave devices (plus the master device, i.e. more than just 2 devices total) in which you can use the same two wires for up to around 128 devices. Serial (UART) communication is simpler, and only needs one wire (plus a common ground) to send data one way, it is what i'll show for the rest of this answer
Here is the manual entry for serial input for the PICAXE, and Here's the entry for serial output from the Arduino. The code you will need given your question will be something like the following:
For the arduino:
void setup(){
Serial.begin(9600);
}
void loop(){
if (conditionMet){ //whatever the condition is in your code
int bytesSent = Serial.write(“HIGH”); //send the string “HIGH"
}
}
and for the PICAXE:
main:
serin 6, T9600, ("HIGH") 'uses qualifier to look for exact message "HIGH"
'do whatever when criteria met
goto main

Resources