Showing posts with label DS1821. Show all posts
Showing posts with label DS1821. Show all posts

Monday, March 7, 2016

More on the dsPIC-EL

OK, so a few months down the road we can give a progress report on the dsPIC-EL and the high school club.

Solderless Breadboard
First of all, the members of the high school Electronics and Wireless Communications Club are wicked smart.  These kids are just unbelievable.  Before building the dsPIC-EL boards we gave them a handful of parts, a solderless breadboard, a schematic, and asked them to make the LED blink.  Your standard first PIC project, but the guidance they got was very limited.  All of the students had little problem accomplishing the task (for that one we used the PIC24FV16KM202 because at the time we didn't have enough of an inventory of dsPICs for all the club members.)

We felt it was useful to start with a "from scratch" sort of build so the club members understood that they don't need to buy an Arduino or some prepared kit to do something interesting.  They are prefectly capable of doing whatever they want.

After they had the LED blinking we gave them a few more LEDs and resistors and told them to play.  Interesting results, and I think it is useful for them to go off with little guidance and explore on their own.
dsPIC-EL-GM

They then built the dsPIC-EL.  The provided dsPIC33EV32GM002 contained an acceptance test so they could see right away that they were successful. (Refer to the construction instructions link on the previous post.) A provided library for the LCD allowed the club members to experiment with the buttons and LEDs and display what they were doing.
Shield with DS1821 annotated

Next up was to add sensing. The ultimate goal is to do a high altitude balloon launch in the spring.  This balloon is to carry a payload containing sensors for those measurements of interest to the club members.  A shield was built for the dsPIC-EL containing a DS1821 digital thermostat.  Again, a library was provided to ease the handling of the Dallas One Wire protocol.

LDR voltage divider
For sensing, analog input will be a must, so next the students added a light dependent resistor to their shield and learned how to read voltage.

The final, sort of "directed" experiment was to add a serial EEPROM to the shield.  In the spring launch, this will be needed to store the measurements for analysis after the payload is recovered.
24FC128 SEEPROM

The club members then split into small teams of two or three members.  One team was responsible for the control processor, one for the storage processor, and the remainder for each sensor module.  The plan is for each sensor to take commands from the control processor, report the measurement, and then have the storage processor store the result.  K8VFO guided the teams in preparing functional specifications and then designs for each of the modules.  Students did Internet research to select sensors and are currently working on firmware for each module.

Initial testing and development is being done on the dsPIC-EL, but the launch payload will use a dsPIC-EL for the control processor, and purpose-built shields for the measurement modules.

K8VFO is also walking the club members through the process of converting their schematics to a PCB layout, sending the design out to manufacture, and testing the resulting board.

Of course, some of our stronger club members will be graduating about the time we do the launch.  We hope the remaining members will return in the fall when we plan to build on this year's progress and address telemetry from the balloon to an earth station.

As I said, these kids are wicked smart.

Saturday, August 8, 2015

Club Project - Thermometer

Recently the local radio club needed something to spice things up, and the idea of a construction project based on a PIC seemed to be well received.  I came up with the idea of a PIC based thermometer, a little off the beaten path perhaps, but easily done.




An awful lot of PIC projects involve nothing more than an LCD and a sensor of some type.  Everyone has done some sort of test instrument; counters, capacitance meters, dip meters, signal generators, and on and on.  But a lot of the club members don't do a lot of building, and while a counter is kind of cool, it only appeals to the more technical members.

A thermometer, on the other hand, is something that everyone can get behind.  Perhaps you won't play with it for very long, but you will play with it.  You will hold the temperature sensor and watch it warm up, you might put it in the freezer, perhaps it will find a permanent home in the greenhouse.  But it is something everyone can at least play with, if only briefly.

I also wanted to try to inspire folks to pick up a soldering iron and perhaps grok a little code long after the build session.  A thermometer based on the Maxxim/Dallas DS1821 is dead simple, and as a totally digital solution requires no calibration, and the adventuresome could easily stick the sensor on the end of a long wire to put it in the garage, or in the garden, or wherever.

For similar reasons I chose the PIC24FV16KM202.  It has a lot of left over pins to tempt people to try other stuff, it has an amazing complement of peripherals to play with, and it is dirt cheap.

We milked the project for several months. First, I did a presentation on PICs in general, went on about how easy they are to use, how cheap, and how flexible they can be.  The next month another ham did a presentation on microprocessors in general, and the differences between microprocessors and microcontrollers.  Then I did presentations on the hardware and software for our build project.  Finally, on a Saturday, we all got together and melted solder.

We also did the project at the local high school radio club.  That was a lot shorter.  Kids of that age are like sponges when it comes to knowledge, and they were no virgins to electronics, so the whole process was a lot quicker!

We did a total of around 30 of these thermometers, only one didn't work when first powered up, and that was a cold solder joint dealt with in just a few minutes.  Not bad for a group that mostly had never held a soldering iron before.  I credit part of that to the very detailed construction instructions (see link below).

We have had some success with folks going out playing on their own.  Not as much as I would like to see, but something is better than nothing.

I had the boards made at Maker Studio.  They will make boards up to 10x10cm for a fixed price.  I filled the unused part of the board with prototyping area in an attempt to get people to try things.

The Circuit


 



Basically, the circuit is nothing more than a PIC, an LCD, and the temperature sensor.  In order to make it simple to get going in the build session, the project was powered by 3 AA batteries.  Because of this, the LCD backlight was not used, although the board provided a jumper to enable it, and a micro-USB connector to enable powering the project from a cell phone charger.  An LED was also provided to indicate the program was working, but also to provide experimenters with something else to play with.


In addition to the PIC, LCD and temperature sensor, the LCD requires a contrast pot, the LED a current limiting resistor, and the DS1821 a pull up resistor.  A reset button was added, along with a few caps.  The PIC24FV16KM202 requires a 10u cap because it is basically a 3 volt PIC running at 5 volts, and it is always good to sprinkle a bypass cap here and there.

The odd values on the resistors are simply because I had bought thousands of those values cheap, and they are in places where the actual value is horribly non-critical.

The PCB

The initial plan was to build the project on perfboard.  That way folks could get the idea that they could simply build whatever they wanted.  But eventually it was decided to do a printed circuit board.  Perfboards are pretty expensive, and if you are willing to wait a few weeks, a PCB can be real cheap.  Plus, it makes it harder for new builders to make errors, especially if the PCB is heavily silk screened.  Later I actually had custom perfboards made,  Turns out that one can get very high quality glass-epoxy boards exactly to your own specifications cheaper than crummy phenolic boards locally.



Of course, the PCB had to include a programming connector (left edge).  As mentioned before, a connector for a cell charger (right) and a simple, two-pin connector for the batteries which are mounted on the back.  The PIC's internal oscillator was used for the project, but pads for a crystal and the associated caps were provided in case the experimenter felt a need for crystal control.  The remainder of the board is filled with prototyping space.

The Software

The PIC is run at a low speed to maximize battery life, and mostly sleeps.  The watchdog timer wakes the PIC about once a minute to take a sample and then go back to sleep.  The PIC only draws microamps when sleeping, although much of that advantage is swamped by the LCD which draws significant current even without the backlight.

The LCD and DS1821 code was buried in libraries to make it easier to talk about the overall logic without getting buried in the details of the specific devices.



The Links

Other clubs might find this a useful project.  All of the source code, schematics, PCB layouts, Gerbers, presentations and the construction manual are all available on GitLab.

The presentations are in OpenOffice Impress format, although the repositories also contain a PDF version.  The construction manual was developed using Publican, but the final result is PDF.  The schematics and PCB were developed using the gEDA tools gschem and pcb.  The source is all MPLAB-X/xc16 code.