We need a few more things to help work out your problem: Please post your code, with in code wrapped around it using the code button above: so that it looks like this Can you also describe in more detail about how the LED is connected. The LED has a long wire and a short wire (probably). Which wire ...
Wow, this is exactly what I was looking for! Would you mind posting the rest of the code? I'd like to see from start to finish how you have this set up. Thanks! Code's up on GitHub/PiStuffing/Quadcopter but the temperature code gets very lost in all the other PIDs the quadcopter uses along with the...
I use M2.5 bolts and 11mm M2.5 spacers between A+ / B+ and a HAT (i.e. any PCB connected to the GPIO pins). For the connector I use on my boards, the 11mm is a perfect fit - no strain on either PCB or the GPIO connectors. M2.5 bolts from ebay are cheap as chips. I got the spacers from Farnell / Elem...
However, is there a function that would return a time with better resolution? I need to measure the time of a pulse and need better than ms accuracy. Or if it's the absolute time it takes to do something rather than the time used by the CPU to do something, then time.time() gives microsecond accura...
My code is time critical - when a sensor is read, it is 'timestamped' with time.time() so that integrating the values is as accurate as possible. time.time returns elapsed time since 1970 in seconds. Resolution is 1us (6 decimal places). It works really well for me. But I just stumbled across time.c...
RPi.GPIO is software PWM so may not be fit for purpose depending on the resolution / accuracy you need.
Hardware PWM is available from RPIO http://pythonhosted.org/RPIO/ but you have to install it manually - it's not included in the standard distribution
My wildlife camera (Raspberry Pi model B, RaspiCam NoIR, IR LEDs, motion detector) runs continuously for 12hours on a 10,000mA power bank. So I'd guess your 50,000mA bank should be able to manage 24 hours. Much bigger problem: who's going to want to spend a week editing a 24 hour video! If you want ...
@paddyg - I'll try the os.nice(-5) - I gave it a go via os.setpriority() but that's Python 3 only. Something else I've just found is you can wrap python 'C' library blocking code with Py_BEGIN_ALLOW_THREADS // Do something blocking here like sleep((int)secs) or epoll() and this will release the GIL;...
On a whim, I ran only the sensor reading thread, and did not trigger the motion processing code. It was able to collect data at 930Hz - I suspect the 70 misses per second are down to not using a RTOS or microcontroller. I had tried increasing the process niceness but os.setpriority() is only support...
Paddy, any reason why in your sample code you 'spawned' 2 threads (reader and PIDer) rather than just using the main thread for one of them? Just asking in case there's a better performance reason for using 2 non-main threads rather than main + 1 other thread.
Ta, Andy
Out of sheer bloody-mindedness, I tried various thread(ing) + locks | signals | Events for inter-thread data transfer. Net result, a draw between the serialized data integration + motion processing, and the thread approach with the data integration thread signalling the motion processing main thread...
Hi Paddy That's exactly how the code is structured - both threads of code run flat out, each only waiting for new data, whether it be from sensors (hardware interrupt signals availability of new sensor data) or from the code batching / integrating the data and periodically passing it over to the mot...
Hi Paddy, I've been tinkering over the last couple of days with thread (the underlying base of threading): one thread for data collection ideally at the 1kHz the sensors push it out, and another for motion processing which happens at 43Hz (my arbitrary choice for tweaking). A basic lock to copy inte...
I use Edimax - either their nano dongle ( http://www.amazon.co.uk/Edimax-EW-7811UN-150Mbps-Wireless-Adapter/dp/B003MTTJOY/ ) or their one with an aerial ( http://www.amazon.co.uk/Edimax-EW-7612UAN-V2-Wireless-Interface/dp/B007H5WXB0/ but beware that they both used to need an updated hostapd (see her...
Although, some googling shows no mention of soft-AP (WAP) support for the MT7601 chipset, so actually I suspect that's the problem: the dongle simply doesn't support hosting a WAP. Maybe the problem is that the dongle doesn't support AP mode... Do you know where can I see if it's compatible? Thank ...
Thanks to everyone who's commented here for their great explanations / advice. I guess the multiprocessor is the way to try - either with a pipe or shared memory between the two OS processes so the data collection scripts could periodically copy batched data to the data processing script (locked is ...
Its my understanding that any language running on Linux is not suitable for real realtime processing as the OS itself is fundamentally not designed for realtime use. So it doesn't really matter what bit of it doesn't work occasionally as it WILL fail at sometime (and not just 1 in 1000000 ratio) My...
The multiprocessing module also avoids the GIL by spawning new Python processes. The price you have to pay is memory overhead. Memory isn't a problem - there is very little stored state, and the code is only a couple of thousand lines including blank lines and vast number of comments - I'll look at...
It seems there are versions of Python that don;t rely on a GIL and handle threading better. IronPython is one that mentions this issue. No GlobalInterpreterLock - IronPython has no GIL and multi-threaded code can use multi core processors Another option could be to write the sensor collection code ...
I'd like some confirmation that Python threads are not real OS threads - i.e. they are controlled by the interpreter rather than the kernel scheduler like normal process threads are? I ask because even with a single core CPU, proper threading and the kernel scheduler does allow one thread to interru...
If you can afford to buy an A+ / B+ and the Adafruit Servo controller then... You can get 16 PWMs from servo from Adafruit 8 PWMs from RPIO 8 input pins So you'd need to take the 14 parallel inputs, and convert them to use 4 GPIO pins to represent them numerically - not sure what small chip would do...
I can't see how any of this will help in doing what the OP wants via shift registers though. I read it that the shift registers were a necessity because of the number of PWM outputs required, but the OP hadn't shared the exact number - so I was just checking that they were indeed a requirement, whi...