Comments (12)
Hey,
Sure - your calculation seems correct, you'd need a lower resistor to drive the LED at that current.
I think the distance we had between the LED and the receiver was smaller - something around 4-5 inches.
I'll update the resistor values, cause you are right in that they are definitely too high. Not sure if we ended up changing them in or installation and I just failed to update the spec.
Thanks for pointing it out.
Regarding the wavelengths of the IR Led and receiver, I know they don't match exactly, but we didn't find this to be a problem.
What helped us also was to make sure the beam of the led is restricted (e.g. by putting the led in a hole in one of the walls on the ball pickup chute)
from foos.
Excellent! I really appreciate the response. Sounds like I'm on the right track. I have a variety pack of resistors coming in tomorrow, so when they come in I'll experiment and see what I can get to work. My testing has just been on a breadboard, and manually pointing the LED towards the receiver. I havnt actually installed in the table yet....I also have a Tornado, with same layout as yours. Really looking forward to getting this working. I'll send you a pic of the setup when its completed.
from foos.
I GOT IT! The whole time it was just GPIO 38khz on pin 18 not working. It needed the wiringpi (non-python app). Which I got with "sudo apt-get install wiringpi". And actually 33ohm resistor seems to be too strong. I've played around with it for about 5-10 minutes and it sorta seems like 330ohm works better. Its like 33ohm is too bright and its not detecting the break in the light.
However, it only works when i manually start the foos.sh after logged in with the pi account. If i start it with the startup script using sudo, it seems like GPIO18 is not sending signal, and i'm back to it not working. So another mystery to solve - how to start up the script without using the sudo command in the rc.local
Edit:
Well i spent several hours trying to get this to work on startup, but just cannot. I tried starting with a cronjob (crontab), I tried adding it to the .bashrc file, and tried different ways of adding to the rc.local, and in all cases I can get it to start up, but pin18 on the Pi is disabled. Pin18 only works when I manually login to the shell as the pi user and THEN launch the foos.py directly, or foos.sh. Maybe i should just order an arduino nano and give up on this pi-only route.
from foos.
Hey! Great to hear that this worked - I'll add gpio to the dependencies in the check script (even though it's for the pi only version it should be good to install it anyways.
There are a few posts on the internet around different problems with gpio from rc.local: https://raspberrypi.stackexchange.com/questions/4664/setting-gpio-value-on-boot
E.g. mentions that it's not on the default path and that you'd have to add the full path.
You can try to run foos from rc.local this way:
PATH=$PATH:/usr/local/bin sudo -u pi /home/pi/foos/foos.sh
or export the PATH before
export PATH=$PATH:/usr/local/bin
sudo -u pi /home/pi/foos/foos.sh
The code assumes it to be n the path here: https://github.com/swehner/foos/blob/master/plugins/io_raspberry.py#L67-L70
Are you seeing something in the log output of foos? Maybe it shows the error there...
If it doesn't we should double check to see that it logs correctly...
from foos.
So I tried both of these methods of setting the path in the rc.local but it didnt work. I also tried putting the entire path in it (the path that I got when logged in as pi).
But maybe the root of the issue can be fixed through getting the software side of things setup right. Which brings up a new question. I tried connecting a pi camera/ enabled the camera plugin, but when foos booted up, it crashed and said I was missing a module. I installed what it said i was missing (with sudo pip3....seems like it was inotify and one or two other ones) and did this a few times with different modules it said it needed, but in the end i was getting different python errors that were more difficult than just installing a missing component.
This leads me to this question: Is there a build of raspbian lite that you recommend using? I had originally installed the latest of wheezy I think, since I know this code has been around for several years so i figured you may have originally used an older version. I couldnt get python3 to work correctly so i just went to the latest of Jessie. This one worked better, and python3 was working, and i used the "pip3 install -r requirements.txt", but I still had to install a few things manually. I might have this off (not sure I took perfect notes), but I think I had to run these to get things working:
sudo apt-get install libjpeg-dev
sudo apt-get install zlib1g-dev
sudo apt-get install libpng-dev
Anyways, I have a nano coming in today, so I may abandon the pi route and go the arduino route. But I would like to get the camera working and thought that maybe I'm just setting something up wrong that has led to my other issues. Like maybe I should just use Stretch or Buster?
from foos.
I think the latest release I tested it with was stretch...
Did you run the "check" - it does verify a few dependencies.
It also checks the memory split, the pi with camera requires a bit more RAM to run both the 3d acceleration and the camera.
I'd double check that.
from foos.
Yeah, i ran the check. And it says everything is "OK" except for python deps, where it says: "Can't check python3 deps for the moment". For GPU memory, I gave it 256. I'm going to try to get it working with the nano tonight, and then once done maybe will try switching to stretch to see if things work better there.
from foos.
So, update! I got the Arduino nano hooked up, and goal scoring is now working perfect. In the few games we've played, it was 100% perfect in goal tracking.
So on the side, i tried setting up a new SD card, using the latest build of Stretch this time. I'm basically starting over under stretch and seeing if I can get the camera to work this time. I followed the instructions exactly, including running the check and also running "pip3 install -r requirements.txt". I still had to manually run these two steps below in order for Pillow to install since the Pillow install failed and was complaining of missing required dependencies:
sudo apt-get install libjpeg-dev
sudo apt-get install libpng-dev
So then in the config.py, i enabled the standby plugin and io_serial plugin. Then i started up the foos code. But I'm getting this error below. I'll try to troubleshoot later tonight or tomorrow, but any ideas? It all seems related to the 3d/UI stuff
Edit: Some other info that I thought might be useful:
python3 --version
Python 3.5.3
pip3 list : (limiting results to stuff in requirements.txt)
numpy (1.17.4)
pi3d (2.34)
Pillow (6.2.1)
python-simple-hipchat (0.4.0)
pyserial (3.4)
google-api-python-client (1.7.11)
inotify-simple (1.1.8)
requests (2.22.0)
RPi.GPIO (0.7.0)
evdev (1.2.0)
from foos.
Great to hear that the Arduino setup worked! I'll see if I can verify the seup for the pi-only version during the weekend.
Regarding the issue during the monkey_patch function.
This isn't actuallly needed for newer versions of pi3d. Can you try removing/commenting the following line?
https://github.com/swehner/foos/blob/master/foos/ui/ui.py#L301
I think there were some recent changes around the piece of code that I was patching here in the recent 2.34 release that make my horrible paching fail (I shouldn't be patching anyways...)
tipam/pi3d@316d5f6
If commenting this line doesn't work, I'll suggest downgrading it to pi3d 2.32
There's an issue #70 regarding possible issues on the pi4 that I think were addressed in pi 2.34.
I'll try to double check it this weekend and commit the change to remove the patching function
from foos.
You are awesome! I probably would not have figured that out. Commenting out that line has everything working now. Video playback is working great, except for the FOV. Its good enough that I would be happy enough with it as is, but for the sake of trying to get it better......
As other people have mentioned, I cant get the whole table in view with camera v2. Almost, but not quite. I tried all the different resolution mode settings as you pointed someone else to (https://picamera.readthedocs.io/en/release-1.12/fov.html).
Mode 7,1, and 6 were pretty terrible. Modes 2,3,5 actually gave me the same result, which is interesting because 2 and 3 are the full sensor area (see image above) but its at 4:3 ratio. I wonder if the top and bottom bands are getting cut off because its displaying it at 16:9. Do you happen to know how to maybe make it display the 4:3 video, but inside my 16:9 monitor? Understanding that it would have vertical bands on both sides. If I cant figure it out, i may just see if i can find a v1 camera somewhere.
Thanks again for all your help. We're loving this setup!
Edit: Looks like full field of view (modes 2 and 3) only goes to 15fps, so my best option might be to just pickup a v1 camera.
from foos.
As an update, in the end, v2 of the camera actually had a better field of view. I think the difference was that you have your v1 camera a little further away from the table, whereas mine is closer. Anyway, I cant get the goalies on either side in the camera view, but thats ok. Good enough. Overall we're super happy with the setup. Thank you for all your help in getting this working! And heres a few photos of the completed project. We also installed a red button on the side of the monitor box to turn the pi on and off. And the table plugs into the wall with just a single network cable. All other cables are hidden. You can close this ticket, but I just wanted to give the final update with these pics. Thanks again!!!
from foos.
That looks awesome! Thanks for sending in the pictures - I should actually add a gallery with pictures of other builds :D
Good that the camera works out of you, btw: I like the LEGO touch to it :D ... and the fact that you managed to hide all the cables!
Re camera: maybe some of the cheap fisheye attachment for cellphones might work https://www.aliexpress.com/w/wholesale-fisheye-lens.html ? Unfortunately I never got around to trying it...
Thanks again for letting me know how it turned out! Hope you enjoy it!
from foos.
Related Issues (20)
- 38khz pwm only to+ IR led or to + ir receiver too? HOT 5
- How i can change the gamemode on Start? HOT 1
- Button Pins dont work.... HOT 5
- Need help, how i can change goalsound?
- Are there any problems running with buster? HOT 2
- what PNP transistor to use HOT 3
- Portrait mode HOT 3
- Problem to install libav-tools HOT 9
- Problem to install libav-tools HOT 1
- Menue zeigt foos-tournament nicht an HOT 1
- RASPI B - GPIO PROBLEME
- Problem tu run GUI HOT 4
- Problem with camera & UI HOT 2
- IR Lichtschranke HOT 10
- Der fernseher geht bei replay kurz aus und wieder an HOT 2
- Die Auflösung der Kamera ist schlecht HOT 1
- Problem mit der GUI (RPi only Setup) HOT 3
- Hardware HOT 1
- Foos läuft plötzlich nicht mehr HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from foos.