PIC


I’ve been playing around with the Arduino Diecimila and the ATMEGA168 over the last couple of weeks to better familiarise myself with the AVR ATMega168 MCU, I’ve been using PICs on and off the last few years, but the decision was made to use the ATMEGA as the MCU of choice for the Strobit Triggr project, mainly due to the open source tool chains available, and the simply programmer required.

In short I’m glad I’ve made the switch and I must say I’m loving the learning experience.  I’ve moved from the Arduino software development platform as I found it very limiting and am now using the open source avr-gcc (win-avr) and Eclipse, using the AVR plugin and CDT plugin as my development platform of choice, I’m comfortable with eclipse as my editor as I’ve been using this for my Java development for the last 5 or so years.

As a task I set for myself to learn the onboard peripherals,  I’ve created a Weather Shield for the Arduino, so far it has the RFM12B RF module, DS1307 RTC, HH10D Humidity Sensor, a HP03D, combined barometric pressure and temperature sensor, and soon to have a light sensor and Dallas 1-Wire interface for talking to the Dallas Weather Station that I’ve had lying around in a box for the last 10 years, (yes one of the original ones released by Dallas in 1998, I’ve been waiting to move in my house for a long time),  I’ll post the weather shield design up on a separate topic later, but suffice to say, I’ve enjoyed playing with the SPI, I2C, ICP, UART and onboard timers.

During the development of the StrobIt Open Trigger Project I’ve been using the HopeRF RFM12B Tranceiver as the RF module. The learning curve was fairly steep so I’ve decided to create a series of How-To articles so that others can easily get the module up and running fairly quickly for their project of choice. So far I’ve already slated these for use in a few other projects around the house, both robotics, home control and weather station related.

(more…)

Well I finished the two prototype boards tonight with some minor changes and a bit of troubleshooting, still lots to do though.  I now have them triggering.  Will be testing further over the next few days to get indication of range etc.  So far it is only syncing at 1/100.  I will be posting more details , schematics, firmware etc as well as I get time.

Strobit Triggr fires up for first time

After a hectic and very hot Christmas (41DegC) I managed to get some development time and finished 2 prototype boards.  My RFM12 header boards still have not arrived, caught up in the christmas mail I guess :(  So I’ve had to resort to hand soldering some wires to the header in the meantime. (Murphys law suggests that as soon as I finish soldering these headers the breakout boards will arrive in the mail)

Tomorrow/Later tonight I will test both of them and see if I can get a remote trigger happening woohoo.

Sorry about the quality of the photos as they were taken with my phone :(

Strobit Triggr PrototypeRFM12 HeaderRFM12 Header SolderedRFM Development

I’m pleased to announce the very ALPHA release of the RFM12 library for the wireless HopeRF RFM12 FSK tranceiver module that I’m using for the strobist open trigger project.  It was developed under BOOSTC for the PIC embedded controller, but should be easily ported to any compiler.

Most of it is untested, hence the alpha release, but it’s a good starting point.  Everything is fairly well documented, but like any project could do with more.   Please send me any bug fixes/improvements that you may find while using it.

Download:  rfm12-0_1a.zip 

Features:

  • 433Mhz and 915Mhz HopeRF FSK RFM12 modules supported
  • Initialisation with a basic config
  • Set Frequency
  • Set Receiver Bandwidth
  • Set Receiver Gain
  • Set Receiver Signal Strength Indicator Level (RSSI)
  • Set Transmit Power level
  • Set Transmit Modulation
  • Set Baud rate
  • Enable/Disable Transmitter
  • Enable/Disable Receiver
  • Transmit a single byte - blocking
  • Transmit a buffer of data - blocking
  • Receive single byte - blocking with timeout
  • Receive ‘x’ number of bytes into buffer - blocking with timout

 TODO:  (not in any order)

  • Testing
  • Howto documentation
  • RFM12 Interrupt handling 
  • Non-blocking Tx/Rx routines
  • MSSP SPI implementation (current SPI implemented via bit bang)
  • Frequency hopping
  • Custom configurations

License:

Released under the Creative Commons - Attribution-Noncommercial-Share Alike

Disclaimer:

Please use this library at your own risk.  I will not be held liable for any damages.

I finally had some time this weekend so I started the hardware verification, mainly getting the PIC and the RFM talking together via SPI, of which I have had no previous experience.  The PIC is receiving it’s clock source from the RFM12 via the CLK pin so I dont need any external Xtals.  The RFM12 default clock rate on reset is 1MHz, so the first challenge is to change the speed of the RFM12 CLK to 10MHz, that way I know the PIC and RFM12 are talking.

 As I’m doing most of my software development with BoostC (http://www.boostc.com), there is a library to use the on-chip MSSP (SPI and I2C) functions of the PIC16f873A, so I thought I’d use this and the on-board SPI functions to handle all SPI communications to the RFM12, after a very frustrating few hours and with my scope monitoring the SPI pins, I finally got the SPI to spit out proper CLK, SDO, and receiving something back on the SDI line after I realised I had not had my interrupts enabled to allow for the non blocking SPI functions DOH!

Now that something was getting out and back in, however none of the commands I sent seem to be getting through, well at least not interpreted as commands by the RFM12.  After much head scratching and re-reading of the RFM12 SPI timing diagrams It occurred to me that the 16bits that make up the the RFM12 commands were getting send through in byte sized chunks, i.e. 8 bits at a time were being sent through, then the next 8 bits were send with a delay in between the two bytes, this makes sense as the internal SPI uses an 8 bit register that gets transmitted, although the library I was using allows from the transmit of any number of bytes via a buffer.  I figured this was the problem and quickly wrote some bit banging SPI functions to test the theory, and straight away the RFM12 responded to my commands and now I have the PIC running at 10MHz.

So now that  all is working in the land of Oz as far as my PIC and RFM12 and talking to each other it’s onto finishing the RFM12 library I started last week and testing that with the RFM12 Demo board so I can test Tx and Rx functionality without having two development boards set up.

RFM12 Demo Board

Trying to fit the functionality into the existing ebay trigger receiver housing seems to be a royal pain in the butt, especially trying to work in with the batteries, so after a few days of PCB redesigns and juggling compments around I have put that particular design on hold and moved forward with my original PIC16F873A design, also I did not like the fact that there was 2 circuits to maintain, a transmitter and receiver, this then leads me to the next problem.  I want something easy for the end user, something similar to the Pocket Wizard Plus that is really a no brainer for the user to drive, i.e. a switch to select operation mode and channels, a 3 and 4 way slide switch respectivly, well do you think I can source any 4 way slide switches easily?  Seems I can get some 3 way easily enough, and I guess I could use a rotary switch but these are too clunky for my liking, but still an option.

Strobist Tranceiver MK1

(more…)

A couple of design changes,  main one being I could not physically fit a single design into the existing housings that would encompass the Tx and RX, the RX housing is the problem as it’s a fairly small board so that means I’ve had to change the processor so that I can physically fit everything as well as the RF onto the board, so now a single design using the PIC 16F873A now becomes 2 circuits, Tx and Rx using a PIC16F88 as the MPU.

Receiver PCB

(more…)

I’ve put an initial design (both eagle source files and PDF) into SVN that is aimed as a board replacement to the ebay triggers.

http://svn.everythingrobotics.com/strobist/mk1/trunk/design/ebay_trigg.pdf

Things seem to have slowed down on the forums qute a bit, I’ve also put a poll up for the project name, based on a few from the marketing topic where a number of people have put forward their suggestions, well, while the poll has been viewed a large number, only 12 people have voted so far, a bit dissapointing, obviously they didn’t like the names I’ve pulled from the forums, Oh well I know you can’t please everyone.

Anyway moving forward….I’ve been busy researching RF modules and coming up with a prototype design.  Currently I have 2 prototypes designs on the go.   One as a drop in board replacement for the Ebay Triggers based on the RFPIC, the other as a Pocket Wizard type trigger, but hackable, based on the Phillips LPC2148 ARM7 Chip.  The designs are not complete by any means.  I’m still in 2 minds about the RFPIC Design I may for go it in favour of a standard pic with an external RF module, that way I could use the same RF module in both designs.

 Ebay Trigger Replacement Preliminary Design (TX)(PDF)

 LPC2148 Based Trigger (PW Replacement) (PDF)

Well it’s certianly been a long since my last post, sorry!  Between getting married and christmas (all on the same day lol), and the kids going back to school, my geeking (as my wife likes to call it) has been taking a back seat lately i.e. not a whole lot happening.  However I have managed to squeeze in bit of learning.  The first getting myself familiarilised with PIC micros, the picaxe although brilliant for small jobs, I have found to be limited, i.e. no timers etc.  so I have been playing around with their big brothers.  The fist learning project was a serial LCD using the 16F84,  I’m using the brilliant Sourceboost BoostC Compiler ( http://www.sourceboost.com/ ) 

Also came across a brilliant DSP guide in an easy to understand language and not heaps  if heavy maths , and its FREE for the online book http://www.dspguide.com/, this really made the light go on, ding! with the Ahh I get it in the smoke and mirrors world of DSP.    I’m definately looking at purchasing a hard cover version.