Author Topic: Min Max temperature on I2C 16x2 LCD  (Read 12822 times)

Mark

  • Full Member
  • ***
  • Posts: 196
Min Max temperature on I2C 16x2 LCD
« on: February 23, 2013, 12:46:03 am »
This is a project we did for 'TheShed' magazine to show newcomers what can easily be achieved, while providing something practical.

It included a number of bits that could be cut and pasted, and adapted, along with simple coding and plenty of comments.
Included is a scrolling 'window' of 7 characters, that shows a larger message.
I have used it in the past to display error messages.

When I got my Digisparks, this was the first thing I tried, and have taken til now to draw the schematic.
Obviously if you use the LCD shield the 4k7 pullup resistors on the I2C line are already present.

Anyway enjoy.

Mark

gcmm3

  • Newbie
  • *
  • Posts: 7
Re: Min Max temperature on I2C 16x2 LCD
« Reply #1 on: April 27, 2013, 03:57:54 pm »
 Hello Mark, forgive my ignorance, but I am very new to this and wanted  to build something almost exactly  like you have here. Problem I am having is when I compile the code  I keep getting these errors.
"Digi_temp_I2C_LCD_2:62: error: 'OneWire' does not name a type
Digi_temp_I2C_LCD_2:63: error: 'OneWire' does not name a type
Digi_temp_I2C_LCD_2.ino: In function 'void ReadTemp()':
Digi_temp_I2C_LCD_2:175: error: 'ds' was not declared in this scope
Digi_temp_I2C_LCD_2:187: error: 'ds' was not declared in this scope
Digi_temp_I2C_LCD_2.ino: In function 'void findDevices()':
Digi_temp_I2C_LCD_2:442: error: 'ds' was not declared in this scope"
Not sure where to find the info to define the errors so I can get them sorted. I know the first project is always painful, but sure would appreciate any help you have to offer..
 

Mark

  • Full Member
  • ***
  • Posts: 196
Re: Min Max temperature on I2C 16x2 LCD
« Reply #2 on: April 27, 2013, 05:09:51 pm »
Greetings ?

You need to have the one wire library in with the others.
I can't recall if its in the IDE or I added it later.

Anyway its attached.
Unzip it into the libraries folder.
You'll need to start the IDE again to pick it up (same with any library in any Arduino IDE).

See how you go.

Mark



gcmm3

  • Newbie
  • *
  • Posts: 7
Re: Min Max temperature on I2C 16x2 LCD
« Reply #3 on: April 28, 2013, 10:26:49 am »
I did download and unzip the onewire into the libraries folder, but for some reason its not showing up in the IDE  list when I load the compiler.. I also loaded the I2C to the library to the same folder and again it doesn't show up. I can obviously go to it and open the file, but that is not going to help since I cant call up the library in the code. Any idea as to what would be the cause? downloading a new zip of the IDE thinking perhaps that the file is corrupt in the original download.
 
okay it works now, but still not sure if the  library  for the onewire is supposed to show up in the list from the IDE or not in the libraries folder. obviously I can go into the folder threw file explorer and see it in there. Is this normal?
« Last Edit: April 28, 2013, 10:39:30 am by gcmm3 »

Mark

  • Full Member
  • ***
  • Posts: 196
Re: Min Max temperature on I2C 16x2 LCD
« Reply #4 on: April 28, 2013, 02:46:40 pm »
Did you create a folder called OneWire with the contents inside that.
I use windows, but not sure what you are using...
(see the attached sketchs)

The library should show when you select 'sketch' from the menu 'import library'.

One Wire should show and if you select it, it drops #include<OneWire.h> into the sketch at the current cursor location. 

You do need to restart the IDE (ie close the Arduino program, then re-open it  ... not just the sketch)

Mark

gcmm3

  • Newbie
  • *
  • Posts: 7
Re: Min Max temperature on I2C 16x2 LCD
« Reply #5 on: May 01, 2013, 11:49:10 am »
This is where I have the file unzipped too  so it looks right but doesn't show up in the IDE..
 

Mark

  • Full Member
  • ***
  • Posts: 196
Re: Min Max temperature on I2C 16x2 LCD
« Reply #6 on: May 01, 2013, 02:57:07 pm »
The pictures shows it in /downloads.

Where does the icon that you launch the Arduino IDE say the .exe is held.?
If I'm not mistaken the IDE will only look at directories below where the IDE is located, unless you include the full path into the # include statement.

Mark

gcmm3

  • Newbie
  • *
  • Posts: 7
Re: Min Max temperature on I2C 16x2 LCD
« Reply #7 on: May 05, 2013, 09:07:46 am »
This should be more clear so you can see exactly where I have the libraries folder and also have the onewire unzipped into the libraries folder. I believe this is correct, but at this point I'm not sure.  The main folder is just sitting on my desktop. Thsnks again for all the help.
« Last Edit: May 05, 2013, 09:10:21 am by gcmm3 »

kamots

  • Newbie
  • *
  • Posts: 13
Re: Min Max temperature on I2C 16x2 LCD
« Reply #8 on: May 10, 2013, 08:10:11 pm »
Hi Mark!

Cool project! I just wanted to note a few things, maybe help you out.

Line 80 has the note "Time for a conversion to take place at 9 bit resolution" with a value of 1000 milliseconds. If the sensor is configured for 9 bit resolution, it takes less than 100ms (94 I think) for the conversion. For one sensor, this makes a simple delay(100); a little more efficient then setting an unsigned long and doing a comparison over and over until enough time passes. I understand you don't want to use delay(1000) since you are preforming other tasks and one second is very long in that case. However you may be able to solve that need by using the text scrolling features built in to the LiquidCrystal_I2C library (scrollDisplayLeft and scrollDisplayRight functions).

Also, why are you declaring two OneWire objects on lines 60 and 61? It looks like you only use the one on line 61, maybe I missed something.

And last thing, I recently released a library for OneWire temperature sensors which may help you out. It actually sets the resolution to 9 bit for you, and supports several sensors if needed. Check it out: http://theforest.us/lab/#4

Let me know if my any of that helped, or if you have more questions. If you use my library, please give me feedback, good or bad :)

Mark

  • Full Member
  • ***
  • Posts: 196
Re: Min Max temperature on I2C 16x2 LCD
« Reply #9 on: May 11, 2013, 06:45:19 am »
Greetings kamots
Line 80 is a cut and paste that missed the checking. So you are correct.
The DS18B20 is in its default mode of 12bit resolution.
The time for conversion is actually 750mS.
Yes you could reduce it down to 750uS (or less if you wanted to drop the resolution), but for this example its not monitoring anything critical, and the mass of the airspace is unlikely to change within 30 secs.
For accuracy I should have changed it to say why its one second ....
 
The text scroll function scrolls the whole display, not just a few characters.
So I'm sure what you are trying to suggest.
It's not a long process, but a continuous never ending one.
 
Delay has deliberately not been used. The original article we tried to show how it becomes a problem, and the article before incorporated two different sketches that were 'time sharing' the uP, utilising millis() rather than delay.
 
re the apparent double declaration.
Upon investigation it seems that two things are being declared.
I cut and pasted some code from an example included in a zip file (addy.zip), and while I can find the file I can't find where I got it from, and its not in the credits.
It compiles without line 60, but I can't test it at the moment so I can't prove it works.
 
I did spot your site and sent a link home to check it out.
Thanks for the invite. I have a few other projects/tasks that I need to get done that will take a few weeks.(hopefully)
 
I did note that we have been found, I prefer to include the credit when I can just so someone can track back.
http://electronicramblings.com/blog1/?p=308
 
 
Cheers
Mark
« Last Edit: May 11, 2013, 06:48:05 am by Mark »

gcmm3

  • Newbie
  • *
  • Posts: 7
Re: Min Max temperature on I2C 16x2 LCD
« Reply #10 on: May 15, 2013, 03:02:12 am »
Well not sure what is going on but must be something to do with my laptop. I downloaded the IDE onto my desktop with windows 8 and problems solved.  Still a little buggy with the usb and how I have to wait to plug in the digispark sometimes it doesn't recgonize the device, but other than that. No complaints.. Thanks for your help Mark.
« Last Edit: May 15, 2013, 03:04:02 am by gcmm3 »

Mark

  • Full Member
  • ***
  • Posts: 196
Re: Min Max temperature on I2C 16x2 LCD
« Reply #11 on: May 15, 2013, 12:39:48 pm »
re the detecting.
There has been some issues with Win7 and devices.
Some have come down to connections, with either poor centre connections or strange windows behaviour.

I'm tending to think its how the later versions of windows deals with the hardware, as well as the driver signing, and polling the USB ports.
Digispark doesn't have signing, or indeed anything that windows can run to and verify.
FTDI have good detail on installing their driver, and Win7 (and above ?) installs 2 drivers, but they make this comment.

Quote
5.1 Windows 7 cannot find drivers for my device
This error can occur if the VID and PID programmed into the device EEPROM do not match those listed in the INF files for the driver. The VID and PID programmed into the device EEPROM may be found by using the USBView utility from the FTDI web site. These can then be checked against the VID and PID entries in the driver INF files. If they do not match, that driver cannot be installed for that device without either re-programming the device EEPROM or modifying the list of VID and PID numbers in the INF files.
Please note that only your own company VID and PID or FTDI's VID (0x0403) and FTDI PID issued for use by the customer should be used in the EEPROM and INF files.


Also as much as you tell the driver wizard not to run away, it still seems to try and find it on the web....
Because the device stops, it runs out of time, and once it gets marked as unknown, it continues to be.


Anyway glad you got it running, enjoy....
You might want to try kamots suggestion about line 60.

I also found a link to a lcd library that was 20 times faster, but I can't recall where I saved it.
The guy had a video of them running, and it should work with all lcd's, although it may need tweaking for the I2C.

Mark

gcmm3

  • Newbie
  • *
  • Posts: 7
Re: Min Max temperature on I2C 16x2 LCD
« Reply #12 on: May 22, 2013, 04:07:22 am »
thats good info and  I will keep that in mind regarding the USB issues i still have errors with the USB on my windows 8 machine but not as often. however I believe that could be more a problem with the USB port its self so need to give it a go with another  plug first.. I am looking forward to playing aorund a bit further

Mark

  • Full Member
  • ***
  • Posts: 196
Re: Min Max temperature on I2C 16x2 LCD
« Reply #13 on: May 22, 2013, 08:40:16 pm »
gcmm3
I came across this post the other day from fraguada
http://digistump.com/board/index.php/topic,634.msg3546/topicseen.html#msg3546
The last post is probably the one of interest, and I wondered if your issues may be similar.

Mark

gcmm3

  • Newbie
  • *
  • Posts: 7
Re: Min Max temperature on I2C 16x2 LCD
« Reply #14 on: May 31, 2013, 04:35:32 am »
thanks for the Tip Mark.. I did try and use a powered hub to see if that could also be the problem but sadly that is not the case. It seems to be a FTDI driver issue. Do you know what one I should install because for some reason the ones that came with the IDE aren't working correctly for some reason...