SIM900 and SIM800L GSM project

This has only just been released I'm afraid. I've just ordered all the seperate bits, SIM7600, 18650 holder, charging bits, etc. This would have fitted my build. Pity...

Sure, if you are looking for a HAT to the Raspberry Pi, I have seen those are available. But in this topic Dave is describing how to use a Arduino UNO connected to the module. Do you know if such similar experimental boards can be found somewhere?

How does it interface with the PI?

Not via UART?

Can you connect to a Arduino Uno via UART?

Another example for the SIM7000A | SIM808

With this device, you are now leaving the comfort zone from a price perspective

2 Likes

So after waiting for 2 months......deliver.

But guess what instead of a SIM7000G they send SIM700JC.

There are a few of the GSM bands missing on the JC compared to the G.

But let load some code, use MQTT to send over NB-Iot, let see what the connectivity is like.

Looking forward to hearing how it goes, and if you get it to work whether you would share your code.

I managed to get my SIM800L small development board working this week with a Wemos D1 Mini using Arduino code. Got SMS send and receive as well as sending URLencoded data to a remote PHP page.

2 Likes

Just a quick update on progress with my SIM900 GSM module connected to a Wemos D1 Mini.

I recently discovered the TinyGSM library (which has been a huge help to me)...

This particular program helped me communicate with my remote BeeBotte broker via port 1883.

Next step will be to send some "simulated" readings, every 15-mins, to Node-RED via the BeeBotte broker and see how much credit that particular activity uses on my SIM card.

2 Likes

Breadboard now fitted with a BME280 and an LED.

As you can see, I am now getting real readings (in my Node-RED flow).
real_readings

I can also send a MQTT command to toggle the blue LED.
This is routed via BeeBotte and is acted upon by the SIM900 which is subscribed to a topic.

It all worked out better and easier than I thought it would (thanks to the TinyGSM library).

3 Likes

Things have moved on at quite a good pace. I found a GPS module in my resources box so I had a go at coupling it to the Wemos and sending Lat & Lon values to Node-RED via the GSM/SIM900.

That all worked out well so I thought... "um - I'll put it in the car and give it a test run". First issue to solve was getting a decent 'solid' supply for the SIM900. At the moment I'm using a mains power adapter with a 5.5mm DC jack in my study.

Then I remembered, I bought a 12V / Mains inverter for the car in case I needed to run a mains driven device if we ever went camping. So problem solved. Next simple step was to take my test-rig from my study and operate it in the car (as is) with the 12V inverter.

I'm doing two things with the readings I obtain from the GPS module:

  • Plot them in realtime on the excellent WorldMap node (in Node-RED).
  • Store them in a remote MySQL dB (via BeeBotte remote MQTT broker)

Here's a plot for my very first journey with my DIY 'vehicle tracker'.
tracker_A

This is what things look like in the dB.
tracker_B_hidden
Track-1 was backing out of my drive and track-23 was arriving back home.
As you can see... at no time did I exceed the 30mph speed limit in our sleepy little village.

If I click on any of the green car icons they reveal data for that particular point.
tracker_C_hidden

4 Likes

Here's a screenshot of my NR dashboard that interacts with my MySQL database.

The horizontal slider along the bottom-edge of the screen selects and filters out the day of the month, while the vertical slider selects a timeframe for the day. These settings are for 19th Nov at 09:00hrs (+/- 1hr).

My wife had a great idea... she said... "why don't you change the colour of the green-car-icon depending on your speed then I can see how well you obey the speed limit".
I'm not sure if I'll have any spare time to implement that idea!!

One thing I might do is... vary the update-interval for the GPS module as at the moment it is fixed at
10-seconds, so as the speed of the car varies the map-markers are closer or further apart on the map.
If I could vary the sampling-interval on my GPS module I could get a sample for each 1/4 mile travelled then the map would look visually better.

For example to travel a 1/4 mile at 60mph takes 15sec, 30mph takes 30s, 15mph takes 60s, 10mph takes 90s and 5mph takes 180s.

Bit of maths and curve-fitting gave this formula.

sample_time = 900 / speed // I think should be able to work out the C++ statement for that.

2 Likes

The way I have done it before is to just compare the current position with the last sent and if greater than (say) 500m then send. If not don’t. ( or maybe then send if time diff is greater than say 5 mins).

1 Like

Thanks Dave for the suggestion - by 500m do my mean... you take the lat & lon values and add/subtract a percentage or a small number to see what size movement there has been?

No I mean 500 metres. Or some distance you choose to drop markers. You can use flat earth approximation to make the maths easier.

2 Likes

You are going to get on troubled, LOL, the flat earth's are going to catch you.

Sometimes to simplify something is better, just calculate in you area what 500m are equivalent in degrees.

1 Like

Yeah - sorry what I meant is you don't have to use the more complex haversine especially if using an esp chip... I usually use 110540m per degree - for latitude, and 110540/cos(lat) for longitude then simple pythagorous. (and can set cos(lat) to a constant if you aren't going to go far :slight_smile: )

I really love this forum as there are so many people who give their time to help poor souls like me.

A big shout goes out to @E1cid who created some extra code for my 'track processing' function node to colour code the car's icon according to its speed-band.

const icon_colour_lookup = {
    "0": "black",
    "1":"blue",
    "10": "green",
    "30": "red"   
}

And here's the visual result / proof.

OMG - I seem to have exceeded the speed limit by 0.173mph along the main road (red car icon) !!!!
UK speed threshold calculation is... (speed * 10%) + 2mph which equates to 35mph (phew).

My wife will be really happy that she can keep 'tabs' on my driving and 'correct me' if I digress.

Can you spot where I stopped to do a right-turn??
Right-turns are an important manoeuvre here in the UK.

1 Like

The speed cameras in Southampton will disagree with you :frowning: 32 is too fast. But at least I got a nice photo of my car !

2 Likes

I've just been turning the following idea over in my head and would appreciate any comments about the feasibility of it before I start trying to implement it.

I've used to Google maps to determine how much the GPS coordinates vary when you move a point along a road and found that for a displacement of 200 metres or so - the GPS values changes by 0.001.

So my idea is to create a virtual box around the last known lat/lon position by adding and subtracting 0.001 to the GPS values.

lat_max = current_lat + 0.001
lat_min = current_lat - 0.001
lon_max = current_lon + 0.001
lon_min = current_min - 0.001

OK - I know I shoud be working with a circular shape, but for the sake of this experiment I'm going to use a square and accept the inaccuracies in the four corners of the square.

Whenever I get an update (new_lat, new_lon) from my GPS Module I need to check if the vehicle is still within the shaded area or has moved to a new position outside it - it which case I need to update the marker on the World Map node (and calculate a new position for the shaded area).

Something like this piece of code...

// Check if vehicle has moved to a new position
if (new_lat <= lat_max && new_lat >= lat_min && new_lon <= lon_max && new_lon >= lon_min) {
   // vehicle is still within the shaded area
}
else {
 // vehicle is in a new area so update World-Map and min/max values 
   lat_max = new_lat + 0.001
   lat_min = new_lat - 0.001
   lon_max = new_lon + 0.001
   lon_min = new_min - 0.001
}

Any comments would be appreciated.

Don't forget the additional complication that the distance of 1 degree of longitude varies with the latitude. When you are near the north pole, for example, all 360 degrees of longitude may only be a few feet. Near the equator lat and long are about the same size.

1 Like