Well I managed to get and SPI answer from the PICtail. I just had to send a littlt nudge.
pi@piv2:~ $ sudo ip link set can0 up type can bitrate 125000
That's step 5 om this tutorial.
pi@piv2:~ $ candump can0
This made the card constantly dump a lot of info. And one of the parts reacted when somebody moved in from of the motion detector.
After that, I managed to connect it with python using this tutorial. I chose to use SOCKETCAN and that worked well. I had to use Python 3 though, but that was a simple change.
I made a simple program that is run on the r-pi. When something moves, it simply says:
"MOTION DETECTED! ENGAGE LASERS! PEW PEW PEW!"That was last week. Then I started to plan how the whole code should be structured.
Today, except for thinking about the structure, I've worked from home. I tried to work via dataplicity but coding python using that console is painfully slow. I hadn't set up SSH connection globally so I tried to do it from home using dataplicitys console. Didn't manage. I think the problem was mainly to open a port on the router. But I learnd a lot and maybe I'll fix it when I get back to work. But tomorrow I will probably focus on making a nice python program that shows like a live update of the SPI values. Not a spamming of the data, more like it rewrites the row so you can see when something changes.
This will help me find out what values are connected to what sensor. I think there is a problem with one/a few of them. What troubles me is that I really lack the skills to fix that, but it's interesting and I might learn a lot.
After that, maybe I can focus on making a nice replicable internet-surveilecne-part without the complete functioning of the alarm. So it can be used on all the other projects. Or upload some values to a database.
Btw, Dataplicitys idea is really cool. Maybe something that can be improved upon.
Inga kommentarer:
Skicka en kommentar