I am pretty new to embedded programming and I am trying to set up BLE to get the sensor data from the temp sensor on the STEVAL-PROTEUS board. I set up the BLE in the .ioc file correctly and can connect to the device and service via the ST BLE Toolbox.
However, I can't seem to find any entry point into the BLE code where I could add my own user code. I read the sensor data in the main function but I don't know how to use the sensor data from main to replace the generic value that is currently transmitted via BLE.
If anyone could point me to the right file/function to add my code or if anyone knows a tutorial that goes beyond the setup of the .ioc file I would be very grateful!
I already debugged through all the automatically generated setup functions/files for BLE and I couldn't find any place to add my own code.
Related
I can't find example how to do BLE pairing with Seeed XIAO nrf52840 board. It doesn't matter to me if it will be Arduino or Circuitpython libraries. Is there something like this somewhere?
I would like to use this board for my project, but would like to ensure that anyone cannot read or change values in the BLE services.
My idea of use is that on the server side I select the device I want to pair with and on the device side I confirm the pairing manually e.g. with a button. From that point on, the server can then communicate with the unit and read or change its values.
Thank you
With Arduino you could try this example: https://github.com/adafruit/Adafruit_nRF52_Arduino/tree/master/libraries/Bluefruit52Lib/examples/Peripheral/pairing_passkey
I am actually trying to implement this feature as well. I was trying in CircuitPython, but I could not find a suitable way. I opened an issue, as there was nothing in their documentation to help.
UPDATE 2023-01-03 - In CircuitPython BLE security is not yet implemented, see answer to the issue I opened.
I'm currently doing my project on IOT.I need a GPS for that.I would like to use my Mobile's GPS for Arduino. How can the connection can be done?
Actually, your question is a little broad. But I would give you some tips to do it.
If you want to get your Android phone GPS data you need to create two apps; one for the Android side and one for the Arduino side. The procedure can be something like this:
Read Phone's GPS data based on what you need (E.g Lat/Long or other GPS parameters).
Create a JSON based on the data, e.g:
{
"lat": 1.234,
"lng": 5.678,
"speed": 100,
"hdop": 1.2
}
Send data to Arduino board through a proper connection (I will explain this).
Get data in Arduino board from the proper connection.
Parse received data (e.g JSON) and convert it to desired variables inside your Arduino code.
Continue your work with the received GPS data.
Let me explain a little more about proper connection. There are many options to do that. A simple option is to use Android Bluetooth and based on that on the Arduino side you need a Bluetooth receiver module which there are many out there like HC-05.
There are a bunch of tutorials to get a Bluetooth module working that you can find based on your Bluetooth module like this.
Another solution for the connection is to use wifi. For the Arduino side, you can use esp8266 and directly program it. There are some variants for it like Node-MCU
which has a builtin circuit to directly program it with an Arduino IDE software.
You can also go one step forward and use the newer ESP32 module which has both wifi and Bluetooth.
The good thing about using esp modules is that there are good APIs for creating your app and. You can find more about that on similar projects like here and here.
I'am working on an IOT project. The goal is to communicate between two openmotes (one is the server and one is the client). When the client receives some data, it is supposed to pass it to an arduino to activate different controllers (like a motor, some leds ...). So, I wanna send data from a openmote to an arduino. The idea is to use a bus. The openmote is the master and the arduino is the slave. Do you have any idea how to do this ? I can't find any documentation fro the open mote part. I thought about using the serial UART but i don't have any idea how to do that.
Thank you !
If anyone is looking for an answer, it is possible to activate the UART 1 on the open mote and to send data to the arduino using that bus. You have to pay attention to the speed you are using on both sides.You can refer to this file to see the functions to use: https://github.com/contiki-os/contiki/blob/master/examples/cc2538-common/test-uart.c
i'm a beginner, and i trying build a GSM embedded device that could send SMS to a mobile phone, so that the phone can locate the location of the device.
I have searched this website for similar topic, what come to me is triangulation calculation.
My question is how do i know which tower the GSM device is near to, and how to connect to these three tower to calculate the location?
In order to do cell triangulation, you need to know the geographic position of the cell towers.
Either you undertake a huge effort to build a cell tower inventory or you are the network operator. In practice, only the network operators render this service, some allowing to query locations via an interface. However, this is not standardized.
you have to purchase GSM module. connect it with microcontroller
read at commands provided by manufacturer first.
there is a AT command for your application
try searching following in datasheet:
AT+CREG.
first configure module using this command.(refer your datasheet of gsm module).
then turn on engineering mode using command:
AT+QENG=2,1. (refer datasheet)
now it will give you automatically ncell,bcch,dbm,bsic,c1,c2,mcc,mnc,lac & cellid
it will give you this periodically or by query according to your command.
there are many websites that can triangulate device feeding them this info
i.e. opencellid.org/
i hope this helps!
I am trying to write a Labview program that takes input from a thermal sensor on serial port RS - 232, applies some basic transformation to it, and displays it on a screen.
I'm wondering if it is possible to somehow simulate the sensor in labview, or by using some external simulator application so I can test my program before I'm given access to the actual hardware.
Is this possible?
I have Labview 2011.
The quickest way to test your VI's logic would be to make a CSV file of example data, and temporarily replace the section that reads from the sensor with a section that reads data values from the CSV file at the same rate.
It's probably not worth trying to emulate the serial port input at a lower level as Labview is generally very reliable at getting data from hardware into your VI - it's up to you then what you do with it!
You could have another program simulate the sensor and write to a different COM port. Then you could connect these COM ports with a null modem cable.
In order to do so, you'll have to work out how your sensor works and feed data in na appropriate format into that 2nd COM port. These data will end up being received by the 1st COM port and eventually by your application-to-be-developed.
If you encapsulate all of your communications code in a subVI or set of subVI's, separate from the code that does the transformation and display part, you can easily substitute test code and test data for the real sensor data. You could write a subVI that generates the test data and replace it with the real sensor comms subVI later, or you could use a case structure in the subVI to choose between communicating with the real sensor and just outputting test data (which, as Moray suggests, you could read in from a file so that you can easily change it).
I would suggest that you write separate subVIs for opening communications to the sensor, getting a data point from it, and closing the comms port when you are finished (though you can probably just use the serial or VISA close function for that). Chain these VIs together using the comms port (aka VISA session) and error wires. The 'open' VI could take an input that specifies whether real/simulated data is to be used and store that choice in a global variable (or a functional global VI) which the 'get data' VI checks each time it is called.
glglgl's suggestion of sending the simulated data from another serial port is also good; all you need to do here is use the serial send and receive functions in some sort of loop to do the same thing as the real sensor would, in terms of receiving commands and sending an output back. This has the advantage that you don't need to make any changes to your main program which should work exactly the same whether it's connected to the real sensor or the simulation program. However, problems with serial comms in the real world often result from instruments or devices that don't do exactly what their specifications claim they do, so just because your program works perfectly with your simulation doesn't guarantee it'll work perfectly with the real sensor if the real sensor does something you didn't expect :-)
Though the other answers offered some really great ideas, I've found an easier way to simulate sensor input that would be convenient for beginners.
Create virtual serial ports on your computer by using a Virtual port simulator. http://www.eltima.com/products/vspdxp/
Get a Modbus simulator. http://www.plcsimulator.org/
Download Labview Modbus Library. http://zone.ni.com/devzone/cda/epd/p/id/4756
Open the Labview Modbus library and run 'MB Serial Master Example.vi'
Now it should be possible to read/write values into the simulator using the example program.
The Block Diagram of example program can be analyzed to find out how data is being transferred behind the scenes on Modbus protocol.