Author Topic: set temp sensor  (Read 6505 times)

plexer

  • Newbie
  • *
  • Posts: 38
set temp sensor
« on: April 14, 2013, 01:34:35 pm »
Ok can this be done with a digispark.

2 character led or lcd display
Buttons or rotary encoder to set temp
Thermistor input
Mosfet pwm to heater

Set temp using buttons or rotary and it drives the mosfet on and off to heat 3d printet bed.

Ben

Mark

  • Full Member
  • ***
  • Posts: 196
Re: set temp sensor
« Reply #1 on: April 14, 2013, 02:40:04 pm »
Ben
yes
Have a look at this posting which should give you most of what you need.
http://digistump.com/board/index.php/topic,529.msg2241.html#msg2241
 
You might want to use buttons on an analogue input to reduce the pin count.
 
 
 
Mark

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Re: set temp sensor
« Reply #2 on: April 14, 2013, 06:33:02 pm »
To use a clicky rotary encoder (or any other simple 2-bit grey code encoder) you'll need two digital inputs. I have a code example up at https://github.com/Bluebie/volume_knob/blob/master/volume_knob.ino - read_knob() as often as you can, and it will return -1, 0, or +1.


If you opt to use a regular potentiometer, you could do this with just one analog input pin. You could also use a variable capacitor as it's quite easy to measure capacitance using a single digital pin. Finally if you like making stuff, you could make an optic potentiometer by combining a light dependant resistor, an LED, and an angle gradient printed on a sheet of overhead projector transparency. Turning the transparency around it's centre point would change the resistance of the LDR.


The main tricky bit is the display. There are some interesting options. One way to go is to make your display out of LED pixels, but then it will be quite big. It's possible to use Adafruit Flora Neopixels with the digispark, which are a branded version of these little LED chips: http://www.ebay.com.au/itm/25pcs-WS2811-SMD5050-RGB-LEDs-/160886742091?pt=LH_DefaultDomain_0&hash=item257598dc4b&_uhb=1#ht_500wt_730 that are available for less than $2 each.


Another option for displays are the adafruit i2c backpack: http://www.adafruit.com/products/292 - it uses only two pins, but I don't know how well the adafruit library will work with Digispark. Probably it will require some modifications to work. Another option is this 7-segment i2c display: http://www.ebay.com.au/itm/7-Segment-4-Digit-Display-Serial-I2C-interface-/110907809378?pt=UK_BOI_Electrical_Test_Measurement_Equipment_ET&hash=item19d29ede62&_uhb=1 or there's this cute little OLED guy: http://www.ebay.com.au/itm/I2C-0-96-OLED-display-module-compatible-Arduino-/130566448551?pt=LH_DefaultDomain_0&hash=item1e665de5a7&_uhb=1#ht_2714wt_754 which would likely require some small modifications to the code to work on digispark.

jaghvi

  • Newbie
  • *
  • Posts: 29
Re: set temp sensor
« Reply #3 on: June 18, 2013, 11:14:24 pm »
Can digispark be used to interface a device which otherwise needs a usb-serial functionality,like temperature sensor??Does the usb s/w emulator has libraries for the purpose?

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Re: set temp sensor
« Reply #4 on: June 19, 2013, 05:17:59 pm »
The digispark cannot currently emulate a USB-Serial adaptor. I'm looking in to how plausible it is to make an arduino library to do this. It looks as though emulating serial could put a lot of strain on the program - when using digiusb the host software on the computer is designed to be very tolerant of digispark programs getting busy and not refreshing often. As usb serial (at least the CDC type) is implemented in a kernel driver by the OS vendor, we have less control over how aggressive it is.


There is also another issue - the digispark can only be a 'low speed' device, which isn't technically compatible with being a CDC serial device. The USB spec forbids it. Luckily Mac OS and Linux don't seem to care and let you do it anyway. Windows on the other hand takes issue with it - but luckily someone has already built a driver which patches the windows cdc driver to support low speed devices.


I think a really cool solution would be if people made DigiUSB kernel drivers so it could expose serial ports system-wide.


In case your question was about digispark acting as a host: no, digispark cannot and will never be able to act as a USB host to interface with other USB devices. USB specifies Devices and Hosts as different things which only work in pairs like that, and hosts have very different responsibilities which the digispark cannot live up to.