-
January 4, 2014
01/04/2015 at 10:03 • 0 commentsAfter toying around with a touch GUI for the chipkit, I was not enthused with the results. It was going to be way too much work to get a half-assed end product, so the new plan is an ARM running Linux. I'm planning on using Linux because Android is too unstable for this application. As for a hardware platform, I'm planning on using the Radxa Rock. I was just going to use everyone's favorite, the Raspberry Pi, but by time I added the cost for it, wifi, a case and a power supply, I was almost 75% of the way to the cost a Radxa Rock, which is almost 4x as powerful. The ODroid was a similar story. It was actually just slightly more than the Radxa after all the accessories where added in, but shipping is $20. The Radxa can be shipped from a US supplier for $6. I think that is a fail on Hardkernel's part, the makers of the ODroid, because they say they're never going to use any outside distributors. If they did have someone in the US or shipping wasn't a third the cost of the actual board I would have gone with the ODroid.
As for a platform, I'm going to be using Mono, a cross-platform port of the .NET framework. I really enjoy writing C# code, its my favorite language, so when I found that I could use it to write programs for Linux, I was all that way on-board. Using the Mono framework is going really well. C# has a lot of useful features built into the language and standard libraries, so I'm able to get a lot done quickly. The really nice thing about Mono is that I can develop, test, and debug on Windows, and the application will still run on Linux. I know that I could have also used the more popular Java language but there's a few reasons why I didn't. First, I'm not all that familiar with Java, and yes code is just syntax and it wouldn't take me more than a few days to get a pretty good grasp on it. I just didn't feel like figuring it quite yet. I'll have to learn Java someday, its a required class for my degree. Second, Java does not allow "unsafe" behavior. I'm not doing a whole lot with pointers but I'm doing my fair share with the serial communication protocol I'm writing, more on that later. There's always work a rounds but its so much easier to simply copy memory with pointers.
Mono's preferred GUI library is Gtk#, which is a wrapper of the Gtk+ library, and I find it more useful and easier than WinForms. It does take a little bit to get used to it's quirkiness but I'm getting though it. Gtk+ is only supposed to be used for actual PC screens but with a little work I'll have some nice touch screen widgets put together. I'm planning on doing some more in-depth posts on my experiences on Gtk#, and share my experiences with others because the documentation is severely lacking.
Another aspect I'm changing with the controller is the communication protocol between all the devices to UART. I was originally going to use I2C but it wasn't fulfilling all my requirements. First its only supposed to be used for short distances, like on the same PCB, however there's some IC solutions out there that can be used to boost/buffer/extend the range, but that's just extra parts and more money. Second, most devices either don't have an useable I2C, or its a pain to setup. To be able to use UART though, I needed a protocol to allow a master to communicate to multiple slaves. I tossed around using Modbus but decided on writing my own. I'm mostly done with it. There's a few tweaks I want to make but it works. I've test this using the chipkit and mocked two slaves and that worked but I haven't tried two physical slaves. I encountered an aggravating hurtle when I was trying to test this on the chipkit. Arduino's compiler fails if the source file extension is .c so even if the code is C, the file extension has to be .cpp. That took me a little bit to figure out.
Code examples at link.
-
ph/ORP circuit
08/04/2014 at 22:31 • 0 commentsRecently I breadboarded the pH/ORP amplification and offset circuit. I don't have any probes or cal/check solutions so I just set up a voltage divider with a trimmer pot to simulate the different voltages. Everything worked as I expected. Other than that I've been working on code here and there, focusing mainly on UI.
-
PWM to 0-10Vdc
08/04/2014 at 22:29 • 0 commentsI finally order a proper assortment of capacitors and resistor, and was able to breadboard my Sallen-Key filter designs. The circuit with 2x gain worked as expected, with a 0 to 10V response of 70ms and no oscillation at any duty cycle either.
The circuit is the same as the one I posted two logs ago (the last three pictures). I tweaked the "voltage follower" filter just a bit though. When I tested my first design I only had unreliable capacitors and it ended up being just a bunch of garbage. After fiddling with it for awhile I was able to get rid of the spiking oscillations with 100K resistors and 0.1uF caps. The zero to full scale response is also around the 70ms mark. Both of these circuits don't need to be fast at all but I just wanted to keep the response under a 1/10 of a second. I have absolutely no basis for that, it just felt like a good number to hit. I did play around with the PWM frequency as well today. I started testing using a 1kHz wave form but then upped it to 16kHz. Changing the frequency did nothing electrically (that I could tell) but higher is better because it keeps any hums out of the hearing range. Humans can hear from 20Hz to 20kHz but 16kHz is pretty damn high and you'll have a hard time hearing it. Sallen-Key frequency response goes right over my head. I tried to read a little bit about it but my eyes start to glaze over after dB's are mentioned to many times.
-
LCD Screen
08/04/2014 at 22:23 • 0 commentsHere's just a quick and dirty update on what's been going on lately with the controller. I did some rethinking about the enclosure scheme and decide to fit as much as possible into one box. All the new schematics, parts lists, and such have been uploaded. I'm currently waiting on a few parts to prototype the dimming and especially the pH circuits. I've also started working the UI, focusing on low level controls i.e. buttons.
Here's what I've got so far. This is the general layout of the main "overview" screen, obviously missing a lot of components.
-
Sallen-Key Filter
08/04/2014 at 22:22 • 0 commentsI breadboarded my PWM Sallen-Key filter, complete with crude hand drawn schematics.
That breadboard picture is pretty much just a bunch of wires. I really need to get better with my picture taking. The next two pictures are the frequency response from zero to full duty and full duty to zero. Both were around 10ms which I'm calling a win. But then I dialed back the duty on cycles and I got all kinds of oscillation.
-
LCD Screen
08/04/2014 at 22:16 • 0 commentsI finally have all the parts soldered on my Control board, and tested that.
My hole size for the speaker was too small so I had to drill them out. There was pretty much no pad left after that so that's why there's the two jumper wires on the back of the board. I also placed the RJ-12 jack a little too close the to headers for the chipKit so it gets a little wanked over to the side.
Also I need some standoffs to keep the LCD screen and the control board from touching.
Here is everything together. So many PCB colors. I loaded up the example sketch from Henning Karlsen UTFT library and nothing happened. Then I remember the backlight on the screen has a PWM input for dimming and I wasn't giving it anything. So I fixed that and bam images on the screen. Now I can start designing screens.