Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:36 28 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PIC based I2C devices.

     Page 1 of 3    
Author Message
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 05:02pm 01 Dec 2012
Copy link to clipboard 
Print this post

Hi all, I'm new here (administrator status OzEloctronics Forum). I have posted a few articles on "home grown" I2C modules and although they have been "looked at" many times, I don't know of anyone ever actually using them.

Many of the projects I put together have been based on the I2C system with a simple AXE 18X master as the hub.

The modules are based on the PIC16F88 (819) and relatively easy to "plug and play" with a little AXE I2C programming. The basic chip can transmit or receive up to 8 bytes and doesn't take too much to build your own function into the "main_loop" part of the programme. It is I2C interrupt based i.e the I2C functions only happen when a start condition and address match occurs, otherwise the "Main_loop" keeps doing its thing.

I have used the modules to control (among others), my solar tracker and am currently working on putting together a battery monitor system for my tray top camper which can be expanded to act as an IR central controller for lights etc.

Modules include:
data expander
12 and 16 key keypads
4x7seg led display
LCD display
7 channel 10 bit ADC
etc.

If there is any interest, I will post the details here.

Regards

David M. (ex RAN)
David M.
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2914
Posted: 05:28pm 01 Dec 2012
Copy link to clipboard 
Print this post

Certainly David,

Your projects sound very interesting and right up this forums alley,

Post away.

Regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 11:23pm 01 Dec 2012
Copy link to clipboard 
Print this post

Hi david,

[quote]If there is any interest, I will post the details here.[/quote]

Now if that requires feet kissing for the information then forget it, and anything higher than an ankle is definitely out.

I know your work well, and think it will be well excepted here.

To dangle a hook is just forum fishing, to present the catch is results, go ahead and post away on your projects, results speak louder than wet hooks, im sure you will receive interest in you projects.

I have used many of Davids developments for projects (often in projects for other forum members here) and they work well.

An example is the keypad used in a solar tracker here.......




This uses Davids I2C keypad chip for the keypad.

His I2C LCD display has also been used in many of my projects too.

If you can program a 18 pin PIC chip with the source code David has written then its easy to create several different I2C slave chips to suit different applications.
Basically one (or 2 chips) types can be programmed as slaves to do different operations.

Yes you can buy a dedicated chip for the same function, but the advantage is having a few blank Pic chips on hand, that you can make into a slave to suit your needs using Davids software.

Pete.





Sometimes it just works
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 11:48pm 01 Dec 2012
Copy link to clipboard 
Print this post

Thanks Pete,

After displaying the quality finish of your product, I'm going to have to really lift my game to present similar quality.

My philosophy is KISS. I try and design the I2C modules so that competent solderers can construct them on vero board or similar. As you know (you did much of the artwork) the art work for PCB construction exists and will be included in the module zip file.

I didn't intend to start with a specific project (such as your solar tracker) rather more generic such as some form of data input (e.g analogue to digital) and a display (e.g 2x16 LCD ) with a simple picaxe I2C master with minimal number crunching.

When that is up and running, I thought I'd add keypad e.g to select adc input channel.

Allow me a bit of time as I have quite a lot on the plate at the moment. A bit busy doing battle with a wind farm. Yes, I know this is a RE forum and believe me we are all for RE but we are living in a wind farm (as turbine hosts) and have chronic health issues directly related to the low and infra sound the turbines produce.

regards

david m
David M.
 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 12:42am 02 Dec 2012
Copy link to clipboard 
Print this post

[quote] Allow me a bit of time as I have quite a lot on the plate at the moment. A bit busy doing battle with a wind farm. Yes, I know this is a RE forum and believe me we are all for RE but we are living in a wind farm (as turbine hosts) and have chronic health issues directly related to the low and infra sound the turbines produce.
[/quote]

Sounds like another topic coming up.
As you are aware, this forum is largely a RE forum, (well it has been in the past) and has strong views to alternative energy and the production of it.

All said, i would think it would be of interest to a wider member base on your facts of living within a commercial wind farm area. (tread lightly)

Pete.


Sometimes it just works
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 12:48am 03 Dec 2012
Copy link to clipboard 
Print this post

Here is a 4x7seg led i2c module for the pic16F88.



The display is driven by the picaxe 18x. I2C pull up resistors are on the 18x board.

The led can be common anode or cathode (software selectable)

The zip file has the hex code to allow programming. I used a single 4x7seg display block from Aztronics in Adelaide but single led displays can be used.

I'll go into a bit more detail after I have posted another 2 or 3 modules then we will tie some together to get them to interact.

After that I'll go into the source code and show how to "grow" an I2C module using a template that I've developed.

Questions please as I don't just want this to be a tute.

2012-12-03_104311_4x7seg_led.zip
David M.
 
muddy0409

Senior Member

Joined: 15/06/2011
Location: Australia
Posts: 125
Posted: 09:55am 03 Dec 2012
Copy link to clipboard 
Print this post

Hi Mobi,
You got a website with all your stuff on it??

Don't poo poo conspiracy theories.
Remember that everything ever discovered started somewhere as a theory.
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2914
Posted: 10:18am 03 Dec 2012
Copy link to clipboard 
Print this post

Mobi,

Are you releasing any schematic or artwork?

Regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 11:33am 03 Dec 2012
Copy link to clipboard 
Print this post

There is a schematic in the zip file (or there should be). I have artwork for PCB in PCB express format which I'll probably put in a zip file with all the other layouts or on a PDF file. The intention was for the modules to be built on vero or similar.

I had a read through a previous thread on 7 seg led displays driving big number leds. It wouldn't take much to put a few transistors in my circuit so that the big leds could powered. My circuit will only handle up to 4 digits which is usually enough. Any more and add a second module with a different address.

No I don't have a web site.
David M.
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 11:39am 03 Dec 2012
Copy link to clipboard 
Print this post

OOps!
I had a look in the zip file and I guess I missed the schematic.

Here it is.




David M.
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2914
Posted: 12:04pm 03 Dec 2012
Copy link to clipboard 
Print this post

  MOBI said   OOps!
I had a look in the zip file and I guess I missed the schematic.




Thanks Mobi,

I like the look of that... It looks like a 4 wire cct (2 for i2c and 2 for addressing to select which 7seg) or are the addressing inputs links for i2c address which means a 2 wire cct..

I assume that the display keeps displaying the last transmitted loads and doesnt need to be constantly updated.??

Regards,

Mick

PS. I like the simplicity of it all and the PIC chips are dirt cheap,.

Mic
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 12:33pm 03 Dec 2012
Copy link to clipboard 
Print this post

Hi Mick,

It is a standard 2wire i2c set up. The two address lines (RB2 and RA5) are hardware jumper select (hi or low) to give up to 4 addresses. That means you can have a display up to 16 digits.

The module keeps on displaying the last code sent to it until changed with another i2c write. When I post the source code, you will see each digit is polled for a few milisecs in a never ending loop until the data is changed by the i2c interrupt.

If I use the picf819 version, it is even cheaper.

All 4 didits can be written to at once (the ususal way) or individually

david m.
David M.
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 11:42pm 08 Dec 2012
Copy link to clipboard 
Print this post

Here is an addition to my picf88 i2c modules.

This is a 7 channel 10 bit adc module. Should be suitable for battery monitoring etc.

It is not continuous read, rather you send the channel you want to read and then read the data on the i2c. I've found it plenty "real time" enough for most purposes.

Don't know if anyone out there is using i2c on TBS or not but here goes anyway.

It is easy enough to drive, just send the channel (1 to 7) out on the control byte and then read the 10 bit code (bytes 0 and 1) - see the zip file attached.

The module is suitable for bread boarding or vero board.

The example shown has a 12 battery across a 10k pot (for variable voltage) and a couple of resistors as a voltage divider to give me reasonable resolution around 0.01 volt/step in the 0 to 50 volt range.

Sorry the pinout sketch is a bit amateurish but I'll do up a proper schematic later.

I use this board as i2c master and various other slave functions from time to time.

Hex file to programme F88 is in zip file as well as picaxe i2c example.






2012-12-09_093658_i2c_adc.zip
David M.
 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 12:09am 09 Dec 2012
Copy link to clipboard 
Print this post

One thought would be if the user could set the reference voltage, so each ADC could have a different reference voltage.(currently reference to v0 i suspect)

Then the chip could be used to read the cell voltages of a battery bank, or perhaps ADC2 = ADC2-ADC1 and ADC3 = ADC3 - (ADC1+ADC2) etc............

It has always been a difficult thing to monitor the individual cells of a battery bank with regards to ground, so could see a good use there.

Although that sounds like a firmware rewrite needed, although it may be of interest to many here to have a I2C module that will allow battery cell logging.

Pete.
Sometimes it just works
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 11:50am 09 Dec 2012
Copy link to clipboard 
Print this post

[quote]the user could set the reference voltage, so each ADC could have a different reference voltage.[/quote]

As you know, my motto is kiss - besides, it would also take some fancy hardware as there is only one Vref inout point on the pic. That would mean selecting a different reference voltage before each adc read. I don't think there would be enough digital i/o pins left on the F88 to achieve that.

I think the better and easier option would be to rig up an op amp cct (or similar device)to give a 0 to 5v swing for each adc input.

david m
David M.
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 11:30am 20 Feb 2013
Copy link to clipboard 
Print this post

From the MaxiMite shield topic

  muddy said  So I'd just like to have a stickybeak at the I2C gear you've done to see what I could use so I don't have to re-invent the wheel, so to speak.


Hi Muddy,

Here's a list of I2C devices I have made and use regularly.

4 digit by 7 segment LED (software switchable common anode/common cathode)
2 line x 20 LCD (Jaycar and Altronics displays)
Data expander (digital i/o)
7 channel ADC
12/16/32 key keypad
PS2 to ASCII keyboard
IR remote decoder (a function of the PS2 keyboard - hardware selectable)
Rotary encoder (converted to a 0 to 9999 counter)
Simple TTL level 0 to 2MHz frequency counter - output in I2C form.
2 wire to 8 bit parallel (half of the PS2 keyboard module)(not I2C)
8 bit parallel to I2C (the other half of the PS2 keyboard)

There are probably variations that I have forgotten. If you have an address clash (rare) you can always alter the source code which I can make freely available - just so long as you have a compiler.

Any device that has digital I/O can be converted to I2C using my I2C "template". It is a F88 or F819 chip with (as standard) 8 addressable registers that can be written to or read from. It is up to the user to write the code to fit in the MAIN_LOOP
section of the template to perform the functions required.

All of the I2C functions are features of the F88/819 chips.

Being I2C, they can be mixed and matched and only need a "BASIC" chip such as picaxe or MM to drive them without having to write overly elaborate software. I haven't found an application yet that needed a data speed of greater than 100KHz.Edited by MOBI 2013-02-21
David M.
 
muddy0409

Senior Member

Joined: 15/06/2011
Location: Australia
Posts: 125
Posted: 10:38pm 20 Feb 2013
Copy link to clipboard 
Print this post

Hi again Mobi.
I've never actually done anything with I2C. Another of those things I'v wanted to do, but never got around to, so this will all be a learning process for me.
Unfortunately, it will also be a couple of months away, as we are right in the middle of packing up everything in readiness for re-locating from Port Hedland to northern NSW. Yep, finally got sick of the heat, dust, heat, cyclones, heat, dust and the heat. Really looking forward to living in a place that actually has 4 seasons and a bit of coolness. (Did I mention we are sick of the heat and dust?)
Leaving next week for a leisurely drive over and expect to be "home" ready for all my crap (Mrs Muddy's description) to arrive and unpack. So I probably won't actually be doing anything constructive (or is that de-constructive?) for 6 or 7 weeks. But I'll still be lurking around seeing what goes on in here.
I do notice from your list at least 3 devices that are interesting.
Copulater.


Don't poo poo conspiracy theories.
Remember that everything ever discovered started somewhere as a theory.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 10:49pm 20 Feb 2013
Copy link to clipboard 
Print this post

Mobi,

I2C is a great way to have multiple devices on a few wires.
As i am busy designing a CMM one of the goals is to break out the CAN and I2C pins so that they can be easily used.
Did you try out the maximum length and number of devices you can connect to a I2C bus.
I am planning to make a 30-40cm long kind of flatcable backplane in which you can plug I2C modules.
I have tested the length and that was not really a problem but at this moment i am unable to test multiple devices on such a length, i have currently only two. If you have more I2C devices available could you try this out?
One of the other goals is to have a section of the I2C 'bus' galvanic decoupled with opto couplers so that you can really separate the power lines. Problem with that though is sped. A good optocoupler would be able to be used until maybe about 10Khz.
Did you use a low speed with your devices?


Edited by TZAdvantage 2013-02-22
Microblocks. Build with logic.
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 11:02pm 20 Feb 2013
Copy link to clipboard 
Print this post

Hi Muddy,

Port Hedland, not far away from Karatha where I was awarded "pig of the week" in the Chief Petty Officer's mess just before I was promoted to Warrant Officer on HMAS Derwent. It was a stitch up because the next week they couldn't have done it. Best mess I ever served in.

Anyway, nuff ot, have you ever done any pic assembly programming and do you have a pic programmer? Pretty important if you want to have a go at growing your own I2C device, mind you, there is always snail mail, but that gets a bit expensive after a while.

In the mean time, I'll put a bit of an article together on the basic frame work of a PIC I2C device probably in the "create an I2C device from a PIC mcu" thread. You'll just have to keep an eye out.
David M.
 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 11:07pm 20 Feb 2013
Copy link to clipboard 
Print this post

I have used I2C devices with 15m or more of cable without problems.
The only part that might need adjusting with long cable lengths is the pullup resistor values will need to be lower.
On average a 4K7 pullup is used, but for long cable runs this needed to be lowered to around 1K.

This had 12 x I2C devices on the bus at the end of the 15m cable, there was 6 temperature sensors and 6 x 16 bit ADC devices, and the data was logged, with showing no errors.

The cable used was the flat phone cable that was often used for extention leads for a phone, this also allowed a dasiy chain system as it used the RJ11 connectors that is standard on the phone cables.

Pete.
Sometimes it just works
 
     Page 1 of 3    
Print this page
© JAQ Software 2024