Having run into hurdles with Arduino, Gene Bransfield now turns to Spark Core development platform to make the needed pet collar and try to get it working.
Looking into another form factor, this is the Spark Core (see leftmost image below). I call it the “Arduino mullet” because it’s got WiFi in the front and Arduino in the back. And of course we need a GPS chip, the GP-635T (see middle image below), and SD card breakout board for writing all the stuff down (rightmost image below).
So, Arduino Mega worked, but the MegaMini says it’s going to be four weeks to ship, and other solutions are too big in size or too small in memory, so I went with the Spark Core, which is also having problems shipping. So I borrowed one from my friend Bill who got me started on this in the first place.The tech on the Spark (see right-hand image): the ARM is 32-bit M3 CPU – that’s cool; 128KB memory – more than I need; SPI and I2C compliant – those are connection protocols between chips and peripherals, it’s got, like, the intranet between microcontrollers; a TI CC3000 WiFi chip – it had that; Arduino compatible – no. People say: “Yes it is,” because they are chip heads and they know the difference. But me, I’m not a chip head yet, and when you say it’s Arduino compatible that means it will work with my external components, and I can just cut and paste the code from one thing to another. But that’s not how it works. Arduino is one thing, the Spark Core is another; and long story short – I’m going to have to start all over again from scratch. And that made me not happy. But despite all this problem with the Spark, it’s very-very cool; it had a really dedicated core group of developers, and I’d be looking on the forums, and one guy came in and said: “You know, I’d really like to see it do ‘blaah’…”, and some developer would stay up all night, and then next morning – boom, there it is! Shout out to peekay123 who helped me a lot on my project. And so I figured all this stuff is getting updated, let’s see what happens.
So, libraries: somebody posted SD card libraries to the forums – they compiled for me, great! Somebody posted GPS libraries to the forums – they compiled and they worked with my GPS Shield, cool! WiFi libraries – not so much, because the Spark Core builds itself as an “Internet of Things” device. So WiFi is really in the background as a service: you’re supposed to do the coding upfront, and they’re just supposed to connect you to the Internet for your stuff; it’s not there to mess with.
But I want to mess with it. So, the Adafruit board that I bought (see rightmost image above) had the exact same chip on it, and Adafruit had their libraries available for download. So I figured, since it’s the same chip, I could download these libraries. And I’d messed with it before, because, you know how Thomas Edison said: “I found 100 ways not to make a light bulb before I finally found a way to make a light bulb,” – I found a lot of ways to not make a kitty collar. So I messed with these things and I made some SSID scanning stuff; I just copied and pasted, put it in there – and bang! It worked!So, now I got the GPS working on the Spark; I got the SD compiled on the Spark, and I got SSID collection working on the Spark. Now I got to start working with those tiny components that I bought, and that means soldering. Who out there knows how to solder and likes it? Soldering is my new least favorite activity. For those of you who are getting ready to learn how to solder, I got some rules for you. Rule number one is: don’t touch the pointy end – that’s where the hotness is (see right-hand image). Rule number two is: always remember where you put the soldering iron down (see leftmost image below). If you violate rule number two, you are going to violate rule number one. Rule number three is: everything looks so easy on the Internet, and it’s not (see middle image below).
That notwithstanding, my first attempts at soldering went rather well (see rightmost image above). I got the SD card breakout board here, this is all my breadboard stuff. The chips on the left-hand side – there’s a cord of the SD breakout board, and I had to solder headers onto the end of the cords for the GPS antenna. So, that went pretty good.In the home testing, everything went great: I was getting the sniffing, I was doing the stuff, I took it out to my yard, I watched my neighbors’ WiFi. Then I took it in a car ride – and there was massive failure, I didn’t collect anything. Why not? Well, again, Spark is an “Internet of Things” device. It’s never meant to be not connected to the Internet. So I was talking to the guys on the forums about how to do this. For example, speaking about power consumption, you always have to turn that chip on and off because it’s just going to suck power. But when you turn it on, make sure you encase all further code in a “If status = = WIFI_ON” clause. “If status = = WIFI_ON” only returns “true” if it’s connected to a known WiFi access point, and if I’m a half mile down the road, that’s not going to happen.
So, what I did is I noticed that I could turn on the chip and then do my SSID scan real quick before it actually made a connection. And that worked perfectly. So I removed that code from live stuff, and that’s all I needed anyway. Now I’m back on track.I took it for a drive and I got data back. I started looking at the GPS coords and popping them into Google Earth, and I was driving on the highway – and they had me off in a lake. I was sitting at my house, and they had me halfway down the block. And I’m like: “What’s going wrong?” Well, whoever posted the GPS libraries they did the media conversion incorrectly. So, now I’m back to having no GPS libraries (see right-hand image).
Read previous: Weaponizing Your Pets 3: Some Fun with Arduino