Today we have installed an updated version of microPython software, which is always a good thing because outdated updates are bad... well unless the new update had some bugs but so far this one doesn't.
Besides that, I have also worked on another module. (wow! by myself! for once! no sarcasm here i'm actually surprised myself)
(KY-001 Temperature sensor module- or Temperature in the kit we got. yeah, not a really funny name)
Luckily, this one was not mislabeled like the other modules, but it is as tricky to obtain data from. Like the other modules, it displays its data from 0 to 4095. It also records temperatures from -10°C/14°F to 85°C/185°F, so it won't really show a jump in data if you were to just place your fingertip on the module.
Another thing to mention is that if you are using a Pyboard instead of an arduino board, you would not have access to a certain command available for arduino boards. This certain function would be able to let you set numbers for the range instead of 0 and 4095, so in short it works as a converter.
So far, I have tried to recreate the function via python coding (with help from Kevin, thanks by the way!) although it's still a work in progress.
I've established a variable (temp) to help read the data the module is receiving. This also required an analog-to-digital conversion(thus the .read), as I'm receiving data instead of displaying(or whatever the antonym for receiving is in coding lingo). It was connected to the 'X5' pin, thus why it equals to ADC('X5')
The problem at the moment is figuring out how the module records data. For instance, every time I would place my finger on it, it would go down from 3980-ish to around 3920-ish. That makes it seem that the 0 value would be equivalent to 185°F, so that is how the slope formula was made on line 3 (based off the good ol' mx+b formula). However, I would receive numbers such as 170.89°and such, which I believe would be false otherwise it would be impossible for me to finish this post.
I've personally have never been great at math, as I am unable to sometimes do the simplest mental math, so I feel I probably messed up somewhere around making the formula. I've also thought that it could've been that there is another formula that works for this but not having an Algebra 2 class for over a month now has had a toll on me as I am unable to remember how to even simplify polynomials now (not that I was good when there was class). Ah, sometimes it's better to have the Arduino board but hey at least I'm going to learn something from this and understand how the function would've worked at the very least.
That's pretty much from today that was exciting. Tomorrow we're probably going to get either more modules deciphered or maybe construct our own robots. Who knows really, but either way it's still interesting to be there!
**update**
i probably should go more in depth about the formula used in line 5, just didn't do so before since I didn't really have much time to finish this post well.
So Kevin and I got the idea that if we were to just change the lowest/highest bit rate (0-4095) and convert them so it would be synonymous to the lowest/highest temperature readings (14-185 degrees in Fahrenheit). So we just used the y=mx+b formula to try to convert that. so our first point would be (0,14) and the other point would be (4095,185) and then we would just find the slope and all that and then the formula happened. Now that I'm writing this, i feel that it's not going to be that easy to convert the temperature...
--Links!--
Kevin's lengthy but interesting post on how to update microPython (it's below the github link)
very short ref about ADC codes (it's just like 3-6 new lines to know)


Silvia, it is such a pleasure to read your blog posts! My goal is to get you to use this as a technical journal that will help you both learn IT and document your learning for future reference. You are doing both things already. Great!
ReplyDeleteNow, to address several of the issues you raise in your post:
1. MicroPython is not the same thing as the pyboard. The pyboard refers to the *hardware* we are using, the physical device we can touch (and plug things into ;-). MicroPython is *software* (though since it is stored on *firmware* on the pyboard, the boundary might appear blurred). It refers to a version of the Python 3 programming language written to run on microprocessors (see https://en.wikipedia.org/wiki/Microprocessor). You will hear people say the pyboard is a microprocessor, but it is more accurate to say the pyboard includes a microprocessor together with other components like LEDs, USB connectors, etc. What is really cool is that MicroPython is running directly on the microprocessor. There is no other operating system layer between Python and the hardware. Ask Kevin to talk to you more about this. It is a great learning opportunity for you, since you can use this experience to get a good introduction to computer hardware.
2. It is not always a good idea to upgrade, as you alluded to in your post. Kevin and our friend Paul from Vermont often accuse me of suffering from a disease we call "versionitis", which is the irrepressible urg to upgrade software just because there is a version that exists with newer version number. This can often be a *bad* idea, since "bleeding edge" versions, as they are sometimes called, can often make you bleed :-( The best rule of thumb is to upgrade only when there is a new feature you need or bug that effects you that has been fixed (those are really the same thing in a way).
3. Try to document *everything* your program is doing. I won't laugh at you for:
f = (((171/4095)*x)+14)
but I sure would like to know where those numbers came from! Kevin has years of experience (which is a kind way of saying he's old, like me ;-) writing solid documentation, so he can be a big help with that.
4. Lastly, if you are going into the IT field, you won't be able to escape math altogether, since math is the language of science and engineering. Hopefully, however, you will be able to learn it in a context that makes it more meaningful, which may make it easier for you to learn. You are clearly a reflective thinker who analyses things deeply. Tying math together with real world technical applications like building robots may be just the ticket for you. (btw. talk to Kevin about this, since he has light to shed on this as well).
Thanks for the explanation! This is most helpful since it leads me to another question: what is the relationship between bit rate and temperature? Does this sensor respond to changes in temperature by varying bit rate? This is all new to me, but it is important to understand.
ReplyDelete