SIM800L Relay control + input notification.

I have a project that uses a SIM800L module with an Arduino Nano Every to control four(4) relays with SMS messages and to make a call if one(1) of any six(6) inputs is activated.
The relays are controlled with 2n2222 NPN transistors with current limiting resistors, a diode for voltage spikes protection.
They are connected to the onboard voltage regulator from the Nano Every that can supply 1.1A.
The relays are 80mA at 5v so the 1.1A is more than enough.
The inputs have pulldownresistors for each one.
The SIM800L module has an LM2596 2A voltage regulator set to 4V.
The connections are as follows:
ARDUINO PIN # | Connection
2 - Relay 1
3 - Relay 2
4 - Relay 3
5 - Relay 4
6 - Input 1
7 - Input 2
8 - Input 3
9 - Input 4
10 - Input 5
11 - Input 6
12 - SIM800L TX
13 - SIM800L RX

I am using the SoftwareSerial library where pin 12 is set as RX and pin 13 as TX.
The problem:
The board does not call when the input is activated.
When troubleshooting with the serial monitor, the signal is registered and everything goes according to plan except the calling. The commands used work on another board that has just inputs.

The board does not register the SMS messages. When troubleshooting with the serial monitor, the messages sent from my phone were never registered on the board.
The commands used for SMS reading work on another board that has only relays.

I made this one as a combination of both.
The code is attached as a file because the message was longer than 9k characters.
A lot of the code is commented out because i only wanted to test calling. There are functions made that can be used for messaging with SMS, notify the user when the signal is removed, and notify a program i made in processing that has a GUI.

Mesana_Gotov.ino (15.1 KB)

It sounds like you have several issues to look at...
Working on the code in chunks (functions) to ensure that each part works by itself.

I know exactly what you’re doing and have a 4-year old project which does what you’re doing (with a newer set of modems).
It’s not simple, but it can be done. The only thing I’d like to improve on is my async modem driver code (based on FONA) to squeeze a bit more functionality.

Each part does work by itself, as written in the post. The calling, relays and reading SMS messages works. But when put together they dont seem to function. What are the issues you said i need to fix?

I’ll need to back to my PC to download the code, but I’ll get back to you in about 12 hours if nothing else....

Just some thoughts... the SIM800 is a really old modem, virtually unsupported.
Using delay() to handle modem responses is not great...
I personally hate software serial for real projects, but that implies you need to bump up to a cpu with multiple hardware serial ports.

I’ll have a look.

I am using the SoftwareSerial library where pin 12 is set as RX and pin 13 as TX.

As far as I know, The Nano Every has a USB serial port, and a second independent TTL hardware serial port addressed as Serial1 on the board pins labeled TX1 and RX0.

I would suggest moving the Sim800L coms to those pins, and use Serial1 instead of software serial.

I can not do that since the boards are meant to be used with a regular nano and a nano every.

to make a call if one(1) of any six(6) inputs is activated.
The inputs have pulldownresistors for each one.

What is driving the inputs? What does the input signal look like.

I ask this, because I see (for example) this in the code for input pin 7

if (digitalRead(7) == 1)
    izvestipozar(2, broj1);
    smsmode = 0;
void izvestipozar(int vlez, String broj)

Then when you call the function izvestipozar(2,broj1) I see this for vlez ==2

else if (vlez == 2) {
    if (imasignal7 == 0 ) {
     //lots of code

I see this regarding the value of imasignal7.

if (digitalRead(7) == 0)
    imasignal7 = 0;
    smsmode = 0;

If digitalRead(7) needs to be HIGH to enter the function, but LOW to execute the body of the function there would appear to be an issue of timing. Your code is complex and I may be missing something, but this conflict on pin 7 state looks strange to me.

The signal is just a 5v connection to the pin trough a relay on another board. The imasignal7 integer is there to make sure the call doesnt happen more than once. Its there to make sure that the code only goes once.
When a signal is seen, if imasignal7 is 0 then the code will run and set it to 1. When the signal is lost it will go back to 0.

@HobbyMen, please do not cross-post. Other thread removed.

I am sorry but i am not cross posting.
If i have other posts it is about different problems/boards.

I am sorry but i am not cross posting.

What you clearly fail to realize is that you did, that we are not engaged in a a discussion, and that if your behaviour becomes a nuisance you will spend time away from the forum.