rocbuilder
rocbuilder
Enugu
67 posts
#BLOG #PROJECT#FOOD#FIT
Don't wanna be here? Send us removal request.
rocbuilder · 8 years ago
Text
Usb gps
Got a usb gps, because the previous one got damaged
https://www.raspberrypi.org/forums/viewtopic.php?t=56023
I still haven't figured out how to use python to get the gps data
0 notes
rocbuilder · 8 years ago
Text
Raspberry pi keyboard
After plugging in a new keyboard, i remembered there was a strange issue, being that the raspberrry pi doesn't properly recognise the keyboard. The \ key returns a # for example
https://www.raspberrypi.org/forums/viewtopic.php?f=26&t=39806&p=331516#p331516
This was my reference to solving that problem
0 notes
rocbuilder · 8 years ago
Text
How to gui?
Because i have little idea how to make a gui for python, i searched the webs and came across this https://www.daniweb.com/programming/software-development/code/216785/tkinter-digital-clock-python It's code for a clock, and i used this clock code to display the strokerate i find
0 notes
rocbuilder · 8 years ago
Text
Reflection of project thus far
So this is the second time i’m attempting this project to make a strokerate counter + gps with a large display screen
The thing about this second attempt is that i was trying out new methods in a failed attempt to make a more efficient code than the first
So one of the things i obsessed over was frequency analysis, trying to get FFT to work, because i assumed it would be an effective way for the raspberry pi to find the frequency compared to what i’d been doing prev which was to find peaks and calculate the freq from there.
The problem with the previous method was that i had many false positives, and the strokerate calculated would be inaccurate and imprecise
The method using fft was above my understanding and resulted in a lot of time trying to decipher syntax
After a couple weeks of that train wreck, i realised i could attempt to improve the previous algorithm, and very quickly, like within a night, produced a new algorithm that worked, having higher accuracy and precision, as well as a faster read time, also being a much shorter length of code
I really banged my head on the table when i realised those simple improvements
0 notes
rocbuilder · 8 years ago
Text
A brief summary thus far
This'll be a summary of what the code does 1. Every 0.05 seconds: I. get acceleration data from sensor II. Calibrate acceleration data III. Apply low pass filter IV. Get summation of acceleration vectors V. If zero crossing, append time to list 2. Every 1 second I. Calculate frequency from 1.V II. Output strokes-per-minute 3. Every 1 minute or longer I. Find mean of each acceleration axis from past 10 seconds
0 notes
rocbuilder · 8 years ago
Text
Waveform origin
Because each axis of the accelerometer's origin points defer depending on the orientation of the sensor (because gravity), they need to be set to zero So a "base" value needs to be found for each axis. To find this value, simply have a function that runs either every few minutes, or when it is detected that the boat is not doing any stroking. Just record the values across the past 10 seconds or so, and get the mean The values to be analysed would be the raw data value - the base value
0 notes
rocbuilder · 8 years ago
Text
Frequency estimation
Instead of looking at it as peak detection, it makes more sense to look at it is frequency estimation. So how to find the frequency? Previously it was suggested to do peak detection, but the problem with this is, there occasionally can be double peaks during the same stroke, also a threshold value needs to be implemented such that noise is ignored Because the number of peaks during a single stroke might not be consistent, a new method was quickly found https://gist.github.com/endolith/255291 Because the zero crossing is definite between strokes, it is a much more sound solution. And the noise can similarly be ignored by using a threshold value A bit more thought would have to be put to this before something definite arises
0 notes
rocbuilder · 8 years ago
Text
Peak detection
How to detect peaks? The sensor values might vary wildly, a threshold can be implemented such that values below a certain point are ignored Then if a certain value is more than the one before it and the one after it, it's a peak Or maybe to add on, peak if (y(t) - y(t-dt) > m) && (y(t) - y(t+dt) > m) - http://stackoverflow.com/a/22583761
0 notes
rocbuilder · 8 years ago
Text
Accelerometer algo
Okay, so let me get this straight, i’ve been thinking about this for 2 weeks and barely have a conclusion
So how we get stroke rate is by measuring acceleration by use of a 3 axis analog accelerometer. The accelerometer being analog and all, gives a waveform where the origin point, or long average, is more than zero. In addition, the values might be choppy, large amounts of inaccuracy.
problem 1: choppy values. Solution: implement an smoothing function
Problem 2: origin not 0 Solution: subtract long average
Problem 3: 3-axis Solution: summation by Pythagoras theorem
But now arises a new problem where Pythagoras theorem always produces a positive value
Problem 4: pythagoras theorem always positive Solution: find axis with largest value, if axis more than origin, result is positive, if less than, result negative
So after all that, the waveform is something useable. Next is to read it, find the peaks…
0 notes
rocbuilder · 8 years ago
Text
Gps module and uart
The gps module i procured uses the uart protocol It took me a very long time to figure out how to read and use the data from a gps through UART on the arduino, and there only seems to be less documentation for the raspberry pi, godspeed There was a post that suggested to connect the gps module through usb instead, but that'd require an adapter, which maybe can be crudely fashioned through a spare usb cable Also, there's this guide that goes through how to read/write from the serial port http://www.elinux.org/Serial_port_programming And the following step would be to read the nmea gps protocol to spit out the relevant data The worst part about using the gps is that my home is pretty much a faraday cage with weak reception for some 10 mins walk
0 notes
rocbuilder · 8 years ago
Text
Python multi-threading
With c++, when i want to run a task ever N seconds, i'd use the delay function or millis function if there are multiple tasks. Thankfully, python comes with a very easy to use multithreading library http://stackoverflow.com/questions/3393612/run-certain-code-every-n-seconds
0 notes
rocbuilder · 8 years ago
Text
Raspberry pi 2, wifi
Occasionally, i have to download libraries or upload code to the cloud, all this requires internet access. Unfortunately, the raspberry pi doesn't have wifi capabilities, and requires an ethernet cable. Becomes inconvenient especially since my desktop isn't near an ethernet port So i bought a wifi dongle, and i'll be following this guide to hopefully get wifi capabilities http://raspberrypihq.com/how-to-add-wifi-to-the-raspberry-pi/
0 notes
rocbuilder · 8 years ago
Text
Storing data
http://www.pythonforbeginners.com/systems-programming/using-the-csv-module-in-python/
by using csv, the large amounts of data from the sensors can be read and written easily
0 notes
rocbuilder · 8 years ago
Text
Visual analysis
matplotlib is able to provide some tools for analysing the sensor data
this here post gives some examples of guis to go along with matplotlib
0 notes
rocbuilder · 8 years ago
Text
saving files in python
I referred to this post regarding how to save files to a specific directory
Then using the date and time, a unique name can be made for each file.
And lastly, an infinite loop can be used to keep writing data to the file
0 notes
rocbuilder · 8 years ago
Text
Analog to digital
The raspberry pi does not have analog gpio, however, by using an analogue to digital converter (ADC), analog data can be read.
Thankfully, documentation on how to do so has already been provided https://www.raspberrypi.org/learning/physical-computing-with-python/analogue/
0 notes
rocbuilder · 8 years ago
Text
"Pisces" : A Raspberry Pi Powered Boat Nav/GPS with Topographic Map Viewer
https://www.reddit.com/r/raspberry_pi/comments/65ouwu/if_it_worked_any_better_it_would_have_put_the/?st=J1Q2JXUD&sh=224e6572 This is very relevant to the project i'm doing The creator mentioned to get to know glade and gtx, so i'll have to look into those. I suppose the first iteration of my gui would look similar to that
1 note · View note