Problems getting Arduino GSM lib to work with Nucleo L073RZ - arduino

I'm trying to use the Adafruit Fona Mini GSM together with the Nucleo L073RZ. There exists a library for the GSM module, but it's for arduino. I've setup the board manager url to make use of the link in this repository: https://github.com/stm32duino/Arduino_Core_STM32/blob/master/README.md to add support for the MCU I'm using.
It's not possible to use SoftwareSerial together with this MCU it seems like. The library disappears when the card is selected. The GSM library supports HardwareSerial by uncommenting some lines though, which I've done. Unfortunately the MCU is unable to communicate with the GSM module.
Tera Term image
This is how everything is connected.
Hardware image
In case it's not apparent by the picture, this is how the GSM module connects to the MCU.
Vio connects to 5V
GND connects to GND
RX connects to TX/D1
TX connects to RX/D0
This is the only code modification I've made in the FONATest example, just to use hardware serial instead of software serial.
// We default to using software serial. If you want to use hardware serial
// (because softserial isnt supported) comment out the following three
lines
// and uncomment the HardwareSerial line
//#include <SoftwareSerial.h>
//SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
//SoftwareSerial *fonaSerial = &fonaSS;
// Hardware serial is also possible!
HardwareSerial *fonaSerial = &Serial1;

Related

Mega R3 WiFi: Initializing issue for serial communication in ESP8266 Module's Code

I have a Mega R3 Wifi board. I Know How to setup serial part in AtMEGA2560 (it's Serial3) But in ESP8266 Module which I programmed a code to setup a Web server and I want to transmit the data to ATMEGA2560, I don't know how I should define serial pins. I tested codes blow but none of them worked:
I used #include <SoftwareSerial.h> and i set
SoftwareSerial mySerial(7,2);// RXD: 7 , TXD:2
I used Serial1 and it transmitted some none sense data ( numbers but they don't mean anything)
Pins are fine, Baud rates too. I just need a syntax in ESP8266 Module which defines serial communication to ATMEGA2560.
Here it is:
In ESP8266 module code side, communication is handled with "Serial" it self No "Serial1" or anything else;

Changing Wire library's Hardware I2C pins for custom arduino

I am trying to change the wires i2c pins to 11,12 (SDA, SCL). I built my own PCB but do not have the i2c lines in the same location. I used adafruits feather52 bootloader.
I found online that changing the variant.h file changes the i2c lines, but I don't have that file on my computer (PC), although my mac does.
I have tried the Wire.begin(SDA, SCL) though that's for the esps
I also tried to edit the wire.h files in both the default wire under C/programs/Arduino and the one under user/AppData/Arduino/adafruit though I haven't found where the pins are set.
The hardware packages are istalled into the Arduino15 folder. The location of the folder on Windows is in users home directory in C:\Users\\AppData\Local\Arduino15\packages.
The variant file is in variants/feather_nrf52832/variant.h
The nRF52 MCU can use any pair of pins for I2C.
So try to change in variant.h
#define PIN_WIRE_SDA (25u)
#define PIN_WIRE_SCL (26u)
to pins you need.
If it works, consider to define your own hardware definition instead of patching the variant.h.
You can't change the hardware I2C pins. They are hardware. That means that they are physically connected inside the chip to the part that drives the I2C. You can use a software I2C to "bit-bang" your communication. But that won't use the regular wire library.
You have a solution though. I was facing the same problem two years ago, and what I ended up doing was using software I2C. It "Bit Bangs" the I2C protocol on any digital pins of Arduino. There are couple of libraries for that. For example, check this one:
https://github.com/Testato/SoftwareWire
Start reading about I2C protocol and try to understand what the library is doing. Then it is possible to simulate the I2C protocol on the GPIO pins you have hardwired
You don't need to change NOTHING to use the Adafruit_SSD1306.h library.
If you're using a generic chinese OLED display, your problem is its address.
By default, the address of the 128x64 is 0x3D and if you have a 128x32 one the address is 0x3C, but chinese displays uses 0x3C on both sizes.
So look up for the line
#define SCREEN_ADDRESS 0x3D ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
and change it for this:
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Then, on your setup function, add Wire.begin(SDA_PIN,SCL_PIN); line replacing SDA_PIN and SCL_PIN with the pins you want to use, adding D before the number, like this:
void setup(){
Serial.begin(115200);
Wire.begin(D3,D4); //To use D3 as SDA and D4 as SCL pins, for example.
those are the only changes you should do. Tested on chinese generic display and NODEMCU made by AMICA.

Use the Arduino Nano's serial interface to communicate with ESP8266 -- currently hangs

I have designed a ledstrip driver capable of receiving commands over UDP-IP. I initially worked with an Arduino MEGA, and currently I'm in the process of deploying the code in an Arduino NANO.
The Arduino NANO only has one hardware serial interface, unlike the MEGA, which has several. This forces me to disable the usual debugging through one of the Serial ports (by sending strings to the computer) and to reserve the one and only serial interface for the ESP8266. In short, I am connecting the ESP8266 to the TX and RX pins in the NANO.
I am aware that I could use the softwareserial.h library, but I'd like to avoid it if possible.
The following function sets up the Wifi object:
void wifi_setup(){
// Initialize serial for ESP module
Serial.begin(9600);
// Initialize ESP module
WiFi.init(&Serial); /* GETS STUCK HERE */
...
}
The problem is: the microcontroller gets stuck in the Wifi.init() function and never abandons it.
I am aware that the serial interface is connected to the USB port, and am suspicious this might be a problem. However, I have tried giving power to the NANO through the VIN pin instead of through the USB port, and it hasn't worked.
What am I doing wrong?
The best solution will be to write separate code for ESP8266 and Arduino Nano - or even only for ESP8266 (NodeMCU to make it easy). It will be much easier. But if you really want to do it in your way, i think ESP uses 115200 baud, and you've set it to 9600.

Sending Data from Arduino to Android using Bluetooth

I am trying to do a project based on arduino and Android in which I want to use ultrasonic sensors and Bluetooth module hc-05 . I want to detect any obstacle using ultrasonic and send it's distance to Android app using Bluetooth. I am completely new to arduino and have never used it before . How could I connect both the Bluetooth and ultrasonic sensor to arduino uno board without using breadboard? Is it possible to connect both of them without using breadboard and just the jumper wires?
You can connect the Bluetooth Module and Ultrasonic Sensor with jumper wires directly to the Arduino.
Depending upon the Ultrasonic Sensor you are interfacing, there must be a library or a sample code. You can tweak the code to get the distance in your desired format or variable.
As far as the Bluetooth is concerned, you can operate it at 3.3v or 5v depending upon the module you use. Most of the Bluetooth module support both 3.3v and 5v - as they have voltage regulators on their break out. I have used these and they work on 3.3v as well as 5v
For instance, check the Bluetooth HC - 05 Module in the below link :
http://www.amazon.in/Verve-VTA009-Bluetooth-Module-HC-05/dp/B00S15XTG8?tag=googinhydr18418-21&tag=googinkenshoo-21&ascsubtag=7a58e842-4c10-40bf-a48f-339edef372a7
For implementing the Bluetooth communication, prefer using the Software Serial. If you connect the Bluetooth HC 05's Rx and Tx to the Arduino's Hardware UART Pins, there can be unpredictable results. I have experienced that using HC05 with Software Serial is reliable. Additionally, you can use the Serial Monitor to debug your code at the same time. I mean, you can send the same data on Software Serial and the Serial port and check if things are as desired.
You can implement, the HC-05 Software Serial at 9600 baudrate. 9600 is the default baudrate on most HC 05 Modules.
For developing the Arduino code and testing it, you can use a terminal client like PuTTY on you computer. You need to establish a bluetooth connection between your computer and HC 05.
HC-05 runs at 3.3V, make sure you do level conversion from 5V to 3.3V using a zener diode. Or buy a level converter if you are new to electronics. If you don't, there is a good chance you will blow up the HC-05. If you could add a photo we can see if its already done on the Bluetooth module, then you need not worry about level conversion
HC-05 is basically a wireless serial port over bluetooh. On arduino create a software serial post using the library SoftwareSerial and send the sensor data to that serial port
There are libraries available for popular HC-SR04 ultrasonic sensor, if that is the sensor you are using.
For testing on android many app are availables like Bluetooh Terminal, you can receive the data sent from arduino.
Yes the whole project can be done without breadboard using connecting wires.

XBee and Arduino communication

I am in the middle of my project, and I am now trying to make a connection between two XBees, exactly like in this the YouTube video XBee Basics - Lesson 2 - Simple Chat Program Between Two XBees in AT Mode. I setup the network in the X-CTU first, and now I am trying to connect the XBees with Arduinos.
In the Arduino programming software, the side of the router works fine - I can see in the serial monitor that it's sending the "Hello World" messages, but on the side of the coordinator, it does not receive any massages.
Platform:
Arduino IDE version 1.03-1.05.
XBee Series 2
Arduino Uno
I suppose that the "Hello word" message on the router side is due to a Serial.print() instruction that you have included for debbuging purpose.
Arduino Uno like my Arduino nano have only one serial port (the usb) and if you use it for power purpose or debugging or transmitting data to the PC it is considered busy and anything connected to the pin 0 and 1 will be ignored.
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip. it is from arduino site).
You need to create a software serial port with the library SoftwareSerial (is it included in Arduino IDE since version 1.0)
to call the library and define the software serial port you can use this piece of code
#include <SoftwareSerial.h>
uint8_t rxxbee = 2;
uint8_t txxbee = 3;
SoftwareSerial Serial_xbee(rxxbee,txxbee);
Rember to connect the RX of the arduino to TX of the XBee and viceversa.

Resources