I just got a wifi pineapple nano, and have been a longtime raspberry pi enthusiast, so I'm super stoked to start joining the two. I've already got it connected to my Pi and have played around a bit with the setup. My specific curiosity right now is whether it's possible to write a program to perform GPIO tasks on the raspberry pi based on events occurring on a wireless LAN broadcast by the pineapple. An example would be to turn an LED on if a specific MAC address is detected, and said client is within some power threshold. My lack of knowledge at this stage is how the pineapple fits with the pi (or any other "host" for that matter).
Specifically, do I write my program (probably python, and later some html and JavaScript served over flask) and host it on the pi? If so, how does it interact with the pineapple to get the MAC address and connection power dB? If not, do I host it on the pineapple? If so, how does the program interact with the pi to utilize its GPIO pins? How would I compile my code so that the pineapple can use it? Are there modules already available that can get me most of the way to my goal?
I don know Pineapple Nano very much, but I found, there is an API with module Tracking.
API You should be able to set script which will run when client with specific MAC address connect to AP. In script you can call some method API/Flask on your Pi.
Next solution can be gpiozero library, which has module pingserver doc,
where you can checking some URL if is online. If you set on your AP static IP addresses for clients you want to track, you can use this module to determine, if is online (connected) or offline (disconnected)
example:
from gpiozero import PingServer, LED
from signal import pause
client= PingServer('192.168.0.155')
led = LED(4)
led.source_delay = 60 # check once per minute
led.source = client.values
pause()
In this example, when client with IP address 192.168.0.155 go online, LED will turn on.
Maybe it will help you.
Peace
Related
I am using Raspberry Pi 4 which comes with 4 USB ports. For my project, I have two mics and both will be connected to Rsp via a USB port. I need to be able to choose which Mic needs to be ON. So basically I need to be able to switch/choose which USB port I want the sound to come in.
I need to be able to choose Mic1 or Mic2. I am writing my code in Python. Is there any library that gives me access to choose a specific UBS port? I really can't find anything.
Appreciate your help.
Regards
I been looking everywhere online for this exact configuration but can't find much.
I want to program my AtMega328p MCU (its on a breadboard) using Python from my Raspberry Pi 4 but I am not sure how to check if communication is going on between them? I have the MISO, MOSI, SCLK, and CE0 pins from the Pi connected to the MISO, MOSI, SCK, SS pins on the AtMega328p respectively.
I understand I have to use SPI communication, however how can I exactly send data from the Raspberry Pi to the MCU to ensure there is communication between the two? Maybe some code to send to the MCU and receive it back? I been using the SPI Dev Python libraries but can't find much info on it. Thank you in advance!!
To load code onto the AVR (program it), you want to use existing software like avrdude that already speaks the AVR ISP protocol. avrdude already has support for using the RPi SPI headers - just use the linuxspi programmer type.
Here's an article by the author that explains it (although there are probably more recent articles if you search around) http://kevincuzner.com/2013/05/27/raspberry-pi-as-an-avr-programmer/
Is there a reason you want to do this from Python specifically? Or are you referring to communicating between the uC firmware and some Python code on the Pi?
First, thank you all for your useful posts. I can usually find what I need from SE without needing to make a post.
I'm hoping to make a timer/sensor device that I can control from a web browser.
I'm planning to hook up a set of sensors by USB or pinouts to a Raspberry pi, then having the Pi host a web server. I have experience writing web servers from scratch in python, so I intend to use python as my programming language for this application as well.
I want to be able to visit the server from another device that will run at a time-keeper's station. By selecting options on the web site, you could control the display portion of the timer or the values of variables (timer reset) also the sensors could trigger update events to show information on the web page.
My primary obstacle in this case is the hardware interface. I imagine I would need to look up how sites like OMSI allow users to control the motors that move their webcam, or other online control of hardware.
What should my search terms be, or do you know of any libraries for python to read and write to external (adafruit-style) sensors?
Thanks!
Anthony
(https://i.stack.imgur./RzWIl.png)
"Raspberry pi python gpio" "Raspberry pi python i2c" "Raspberry pi python spi"
I am new here and this is my first post. I am not 100% sure where to post this. I think it is something on the OS level so I chose to post it here. Moderators please move it to the correct place if it does not belong here.
I am developing a controller to control a industrial type process. I started off using the Arduino Yun that is a all in one type board with a Linux processor and Arduino controller on one board (if you dont know that already). It uses what they call the Bridge to communicate between the 2. Basically it talks over the com port and you don't have to build your own protocol, it does it for you.
Now the Yun is turning out to be to low specked for what I want to do so now I want to use a Raspberry Pi and hookup an Arduino Mega to do all the low level sensor stuff.
As luck would have it Paul Stoffregen ported the library so it can work on any linux type system using any Arduino board
(Arduino Code) https://github.com/PaulStoffregen/Bridge
(Python Code for the linux side) https://github.com/PaulStoffregen/BridgeUSB
So what it does is you set-up the Pi so when you connect the Arduino it will auto login on the comm port as root (via the usb connection) and then it should start the Bridge.py script. Now here is my problem, in fact I have 2 of them
1) The Bridge.py script does not fire (it does not start up)
2) The Arduino does not auto connect on a Pi reboot.
I can see the Arduino is connecting as root when I plug it in
root#RedPi:~# who
root ttyACM0 2016-03-10 18:01
I have the Arduino side working as I can see it is sending the data.
If I cat the port I can see it is sending the data
cat /dev/ttyACM0
run-bridge
▒XX100▒q▒XX100▒q▒XX100▒q▒XX100▒q▒XX100▒q▒XX100▒q▒X ...........................
But it does not run or execute the "run-bridge" command. But if I type it as root on a ssh session it runs.
And then if I reboot the Pi I have to pull out the plug and push it back to connect to ttyACMo again. But when I do a lsusb I can see the Arduino there. I guess I have to add a bit of config to tell linux to do it at startup.
You have to add this bit. And I was hoping it would take care of the USB at boot as well
# UDEV Rules automatically start a shell on a USB Serial device.
#
# This file must be placed at:
#
# /etc/udev/rules.d/00-bridge.rules
#
KERNEL=="ttyACM*", RUN+="/usr/bin/run-bridge-udev", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{MTP_NO_PROBE}="1"
I hope you can help me. I do not want to rewrite all my code that is working on the Yun. So if I can port it it will be great.
So I'm building a system where I scan a RFID tag with a reader connected to a Raspberry Pi, the RFID tag ID should then be sent to another "central" RPI, where a database is checked for some info, and if it matches the central Pi sends a message to a lamp (also connected to a Pi) which will then turn on. This is just the start of a larger home-automation system.
I read about MQTT making it very easy to make more RPIs communicate and act on events like this. The only thing I am wondering about, but can't find documented on the internet, is whether the central Pi in my case can act like the broker, but also be subscribed to the topic for the RFID tag ID, check the database and then publish to another topic for the light.
Purely based on logical thinking I'd say yes, since the broker is running in the background. Thus I would still be able to run a python script that subscribes/publishes to, I'm guessing, localhost instead of the central Pi's IPaddress and port.
Can anyone confirm this? I can't test it myself yet because I have just ordered the equipment, and am doing lots of preparation-research.
You can run as many clients as you like on the same machine as the broker (You could even run multiple brokers as long as they listen on different ports). The only thing you need to do is ensure that each client has different client id