Pi Gurus required (or something like that)
Pi Gurus required (or something like that)
Author
Discussion

mondeoman

Original Poster:

11,430 posts

296 months

Monday 28th March 2022
quotequote all
Here is a software and hardware challenge that I can t quite resolve.

The problem definition is as follows:

There is an automatic gate across the entry / exit to a car park.
Outside the carpark is a numerical keypad that will open the gate, but from where this is you cant see inside the car park.
Inside the carpark is a green button switch that will open the gate
The standard gate automation takes care of closing the gate automatically 1 minute after it reaches the open position.

What I want to do is
1) allow the first user of the day to enter the car park using the keypad, then stop anyone else coming in for 50 minutes by turning the keypad off. There may be more than 1 car going in at this time, and the first user can always let another car in during the 50 minutes by using the green button.
2) at the end of the 50 minutes, the first user and anyone else inside at the time have to leave, so the car park is empty for the next user.
and so on and so on throughout the day.
3) If the car park isn't empty, the keypad needs to be disabled so the next user cant come in.

How would you solve this?

I've thought about a raspberry pi with simple relay and timer to power off the keypad, and then a camera and "image recognition" to look at the carpark and determine if its empty, but I dont know enough about image recognition to know if this is easy to do or a hiding to nothing. What other solutions could there be ??

somouk

1,425 posts

228 months

Monday 28th March 2022
quotequote all
I think. you probably need to talk to a proper access control person for this level of complexity. As you say, knowing whether there is anything already in a space is tricky. What if the car park is full before the day starts as someone left a car there overnight for example.


julian64

14,325 posts

284 months

Monday 28th March 2022
quotequote all
I would say a simple ultrasonic counting device at the front gate

Then you would have a count of the number of cars coming in, and you could equally count them on the way out

ultrasonic sensors aren't expensive and can be used to profile moving objects to detect an actual car,

walamai

459 posts

237 months

Monday 28th March 2022
quotequote all
I'm fascinated by the specifics of this and why on earth you'd want to implement it as described, but that's not what you are asking! smile

It's fairly easily doable with a Pi I think.

Rather than trying to count cars, or check in spaces etc, I'd approach it being tracking who goes in and out. Have the system 'reset' overnight so that cars left long term in the carpark don't mess things up.

Then just use number place recognition as cars come and go. First result from google is: https://randomnerdtutorials.com/car-plate-recognit... Seems quite doable.

Just add and remove cars from a local list on the Pi, so you always know who is or isn't in the carpark. Then "if empty' of "if >50 mins" you can apply your gate logic however you like.

It's trivial to have the Pi control a relay to enable/disable power to the keypad.

mondeoman

Original Poster:

11,430 posts

296 months

Monday 28th March 2022
quotequote all
walamai said:
I'm fascinated by the specifics of this and why on earth you'd want to implement it as described, but that's not what you are asking! smile

It's fairly easily doable with a Pi I think.

Rather than trying to count cars, or check in spaces etc, I'd approach it being tracking who goes in and out. Have the system 'reset' overnight so that cars left long term in the carpark don't mess things up.

Then just use number place recognition as cars come and go. First result from google is: https://randomnerdtutorials.com/car-plate-recognit... Seems quite doable.

Just add and remove cars from a local list on the Pi, so you always know who is or isn't in the carpark. Then "if empty' of "if >50 mins" you can apply your gate logic however you like.

It's trivial to have the Pi control a relay to enable/disable power to the keypad.
oooh now thats getting really fancy!!

The best bit is I know that the car-park will be empty overnight, and, the best bit, I "know" who should be using the car-park, and when they should arrive, so I could probably generate a daily list of allowed number plates, certainly for the first car of each group.

Number Plate recognition could be the way forward, would you need 1 camera on the way in (by the keypad) and one to make sure everyone leaves, or is it all done by just 1 camera reading front and rear numberplates??

julian64

14,325 posts

284 months

Tuesday 29th March 2022
quotequote all
I could be wrong but isn't that number plate recognition cloud based computing?

I did a similar thing with a front door face recognition thing a few years ago, the problem was that if you lost the internet connection it stopped working

jan8p

1,843 posts

258 months

Tuesday 29th March 2022
quotequote all
Counting seems the easiest.

Could even make it easier and avoid sensors by just counting how many times the entry keypad has been used vs. the exit button? So entry is +1 to the count, exit button is -1, so as long as the count is 0 then someone can enter. Possible variations as you need to allow the person inside to open the gate manually, but doable.

paulrockliffe

16,599 posts

257 months

Tuesday 29th March 2022
quotequote all
You could use a fairly basic image recognition setup - use a camera and some method that compares the current view with a picture of the empty car park. That way you don't need complex ANPR, or image recognition, just basic, how much does one thing look like the other. Might need some calibration if there's other stuff in there that moves, but could work fairly well and should be more within the range of Raspberry Pi or Arduino.

biggiles

2,171 posts

255 months

Tuesday 29th March 2022
quotequote all
Isn't the real problem here that people cannot see if the car park is full or not?

Is there any way of doing this without a high-tech solution which at some point may fail in the next few years?

Otherwise I think a simple counter at the entrance which tries to count up/down daily, and is then reset at night would make sense. This shouldn't need a Pi, and is probably available off the shelf from someone, maybe your gate supplier.

paulrockliffe

16,599 posts

257 months

Tuesday 29th March 2022
quotequote all
biggiles said:
Isn't the real problem here that people cannot see if the car park is full or not?
Not sure, to me it sounds like some sort of venue where people turn up for a short period of time, leave, then the next lot come in. Everyone out before more people come in. If you've booked the venue, you turn up, enter the code, then your guests can get in, and everyone leaves together.

No idea if that's what it is, but what's described isn't as simple as if there's a space oyu can come in.

mondeoman

Original Poster:

11,430 posts

296 months

Tuesday 29th March 2022
quotequote all
paulrockliffe said:
biggiles said:
Isn't the real problem here that people cannot see if the car park is full or not?
Not sure, to me it sounds like some sort of venue where people turn up for a short period of time, leave, then the next lot come in. Everyone out before more people come in. If you've booked the venue, you turn up, enter the code, then your guests can get in, and everyone leaves together.

No idea if that's what it is, but what's described isn't as simple as if there's a space oyu can come in.
We run a number of secure dog fields, the next one only has a single track road leading to it, so I have to "hold" customers away from the gates until I know the carpark is empty, otherwise chaos will ensue.

Cant rely on customers to do anything for themselves/others, so it has to be automatic. There is also the desire for us to make this as easy as possible for disabled users, hence the move away from a padlock and swing gate to an automatic gate.

walamai

459 posts

237 months

Tuesday 29th March 2022
quotequote all
julian64 said:
I could be wrong but isn't that number plate recognition cloud based computing?

I did a similar thing with a front door face recognition thing a few years ago, the problem was that if you lost the internet connection it stopped working
Ah, that was a bad example that I linked sorry and you're right, that one was cloud based. It can definitely be done locally though, a Pi 4 has enough power to do the recognition comfortably. Training the dataset requires some grunt, but once you have a trained dataset a low powered device can do image recognition.

https://platerecognizer.com/anpr-on-raspberry-pi/

paulrockliffe said:
You could use a fairly basic image recognition setup - use a camera and some method that compares the current view with a picture of the empty car park. That way you don't need complex ANPR, or image recognition, just basic, how much does one thing look like the other. Might need some calibration if there's other stuff in there that moves, but could work fairly well and should be more within the range of Raspberry Pi or Arduino.
I don't think this really works in the real world unfortunately due to lighting changes. A basic image comparison to a computer looks completely different depending on lighting. It's why motion detection on cheap security cams is terrible!


biggiles

2,171 posts

255 months

Tuesday 29th March 2022
quotequote all
mondeoman said:
paulrockliffe said:
biggiles said:
Isn't the real problem here that people cannot see if the car park is full or not?
Not sure, to me it sounds like some sort of venue where people turn up for a short period of time, leave, then the next lot come in. Everyone out before more people come in. If you've booked the venue, you turn up, enter the code, then your guests can get in, and everyone leaves together.

No idea if that's what it is, but what's described isn't as simple as if there's a space oyu can come in.
We run a number of secure dog fields, the next one only has a single track road leading to it, so I have to "hold" customers away from the gates until I know the carpark is empty, otherwise chaos will ensue.

Cant rely on customers to do anything for themselves/others, so it has to be automatic. There is also the desire for us to make this as easy as possible for disabled users, hence the move away from a padlock and swing gate to an automatic gate.
That's useful context. And to know you have limited influence over the users (they aren't employees for example).

Another option:
1. Allow users to leave at all times
2. Fit timer control box with SMS over-ride
3. Allow the gates to open for any incoming users from x:00 to x:15 for every hour it's booked. If they are late, you have the option for HQ to SMS the gate, but you might not advertise this fact. You may even be able to set it up for a computer to SMS the gate every hour booked to say "allow entry for 15 minutes from now".
4. Communicate to users they must arrive within 15 mins of their slot start-time. And if they find anyone there from before, notify you to deal with them.

You will probably have this problem of people over-staying for good/bad reasons (whereupon "chaos will ensue") whatever technical solution you put in place! Personally, if I were a paying customer and the previous user over-ran, I'd be even more annoyed if the gate didn't let me enter at all until the previous user has gone.

julian64

14,325 posts

284 months

Wednesday 30th March 2022
quotequote all
You could have a small arduino bases GPRS.

When the last person texts you , then you could close/lock the gate by text. That way each team going in and out would be monitored by simple text commands from your phone

mondeoman

Original Poster:

11,430 posts

296 months

Wednesday 30th March 2022
quotequote all
biggiles said:
mondeoman said:
paulrockliffe said:
biggiles said:
Isn't the real problem here that people cannot see if the car park is full or not?
Not sure, to me it sounds like some sort of venue where people turn up for a short period of time, leave, then the next lot come in. Everyone out before more people come in. If you've booked the venue, you turn up, enter the code, then your guests can get in, and everyone leaves together.

No idea if that's what it is, but what's described isn't as simple as if there's a space oyu can come in.
We run a number of secure dog fields, the next one only has a single track road leading to it, so I have to "hold" customers away from the gates until I know the carpark is empty, otherwise chaos will ensue.

Cant rely on customers to do anything for themselves/others, so it has to be automatic. There is also the desire for us to make this as easy as possible for disabled users, hence the move away from a padlock and swing gate to an automatic gate.
That's useful context. And to know you have limited influence over the users (they aren't employees for example).

Another option:
1. Allow users to leave at all times
2. Fit timer control box with SMS over-ride
3. Allow the gates to open for any incoming users from x:00 to x:15 for every hour it's booked. If they are late, you have the option for HQ to SMS the gate, but you might not advertise this fact. You may even be able to set it up for a computer to SMS the gate every hour booked to say "allow entry for 15 minutes from now".
4. Communicate to users they must arrive within 15 mins of their slot start-time. And if they find anyone there from before, notify you to deal with them.

You will probably have this problem of people over-staying for good/bad reasons (whereupon "chaos will ensue") whatever technical solution you put in place! Personally, if I were a paying customer and the previous user over-ran, I'd be even more annoyed if the gate didn't let me enter at all until the previous user has gone.
To be fair, late leavers are very rare, and we're only a phone call and 4 minute drive away to sort out issues "on the spot". We just have to make sure that the gate cannot open if there is anyone inside, the consequences of losing someones dog out of a secure field just aren't worth the risk.

Would simple light beams on either side of the gate work? Count in and count out?

mondeoman

Original Poster:

11,430 posts

296 months

Wednesday 30th March 2022
quotequote all
julian64 said:
You could have a small arduino bases GPRS.

When the last person texts you , then you could close/lock the gate by text. That way each team going in and out would be monitored by simple text commands from your phone
Interesting -

I was looking at using NFC on the phone, linked into our app, and linked to the gates, but our app developer wanted £10k, and thats way outside our budget.

Maybe multiple ultrasonic sensors built into posts around the carpark would give me a wide enough field to determine if a car is still in - any positive signal and the keypad stays off.

Miserablegit

4,444 posts

139 months

Wednesday 30th March 2022
quotequote all
If using number plate recognition then remember any Audi is likely taking up 2-3 spaces.

Miserablegit

4,444 posts

139 months

Wednesday 30th March 2022
quotequote all
By the sound of things there is only ever one car in the car park- in which case the gate safety-light beams can be used. Once a car has exited (cleared the car park light beam and the gate light beam) then the gate is re-set to allow opening from outside again.

Miserablegit

4,444 posts

139 months

Wednesday 30th March 2022
quotequote all
Sorry, in true PH form I didn’t read the
OP correctly.
If it’s only two cars max being let in then they can still be counted in /out of the car park using the light sensors.

mondeoman

Original Poster:

11,430 posts

296 months

Thursday 31st March 2022
quotequote all
Miserablegit said:
If using number plate recognition then remember any Audi is likely taking up 2-3 spaces.
rofl and 3-4 for a BMW?