Recent Posts

Pages: [1] 2 3 ... 10
1
Hi there, just bought my digispark and super excited.

I'm having trouble getting my computer to recognize there's even a device being connected. The issue isn't with drivers or arduino IDE, I followed the steps very carefully (yes, arduino ide upload mode doesn't detect either, yes the options are all set to proper values). My computer literally isn't detecting a new device has connected, or any device has connected which means this is before drivers and everything in that sorts.

I'm running Windows 10 Pro for reference and have been trying to fix this issue for the past hour. Another thing, when I plug in my Digispark, a red LED starts shining but unlike some documents I saw, it does not blink after 5 seconds, it just stays on as long as the device is connected. Thanks in advance.
2
Hi All,

I am new to ATTiny85 based development and have been working on a experimental project - turn on light/fan with motion detection using ATTiny85, PIR Sensor and Relay (5V) Module.

I have connected PIR sensor module (OUT pin) to PB2/P2 (external interrupt pin) and Relay Module is connected to PB0/P0.

Code flow:
1. Configure PB0 as output and PB2 for external interrupt (RISING edge)
2. Initialize and configure Timer0 with pre-scaler as 1024. I am using timer0 to turn off relay module.
3. Now, wait for the interruption
4. On interruption, i.e. motion detection, turn on relay module by setting PB0 to LOW and start timer0 inside ISR.
5. Once timer0 is started and after expected time (say 10sec), on ISR (TIMER0_OVF_vect) set PB0 to HIGH to switch off relay.

Now, my observation is after expected time relay gets off and immediately gets on again due to unexpected interrupt received on PB2. There is no motion detection during this time.

This problem is not observed when I replaced relay with an LED(+ 220ohms reg). It seems while operating relay, specifically while switching off, causing instability with board.

ATTiny85 Board: https://ae01.alicdn.com/kf/HTB1yIilHFXXXXbmXpXXq6xXFXXXq/221354416/HTB1yIilHFXXXXbmXpXXq6xXFXXXq.jpg

Relay Module: https://core-electronics.com.au/media/catalog/product/cache/1/image/650x650/fe1bcd18654db18f328c2faaaf3c690a/0/1/018-db-relay.jpg

PIR Sensor: https://images-na.ssl-images-amazon.com/images/I/41fWDsh14LL._SX342_.jpg

Power Supply: USB Charger to ATTiny85 Board. Relay and PIR sensors are connected to Board's VIN and GND.

Please let me know if I am missing anything on connections or any where else.

Thanks,
Mehul


3
Digispark Libraries / Re: timer1 interrupt kills digiUSB
« Last post by Klaus on December 13, 2017, 04:37:25 am »
Same happens with DigiCDC / SerialUSB.
Does anybody know any USB library for digispark which does not perturb/is not perturbed by the timer1 interrupt?
4
Digispark (Original) Support / Re: What went wrong?
« Last post by strykeroz on December 12, 2017, 02:17:39 am »
Very old thread I know, but wanted to post a thanks. Same issue, now resolved with the advice here.  I'm on IDE v1.8.5.
5
Off-Topic / Re: Sending message to the forum with linux
« Last post by ข่าวบอลวันนี้ on December 12, 2017, 12:23:33 am »
6
Digispark Libraries / timer1 interrupt kills digiUSB
« Last post by Klaus on December 11, 2017, 09:38:47 am »
When trying to use the timer1 interrupt *and* digiUSB, digiUSB doesn't work any more (in the loop it prints only one line - see code). Without using a timer1 interrupt, digiUSB alone works. The timer1 interrupt works in both cases. Some time ago i read in some forum about a new version of the digiUSB library compatible with timer1 interrupts, but the link to it was not valid. Unfortunately i can't find it again.

Does anybody know a link to a digiUSB library which does not perturb/is not perturbed by the timer1 interrupt?

This is the code:

#define useTimer1 true  //to verify digiUSB, set useTimer1 false

#include <DigiUSB.h>
#include <avr/io.h>
#include <avr/interrupt.h>

#define adc_p2 1
#define outPin 0
#define ledPin 1  //LED on Model A  or Pro

volatile int y, u, w=500, p=100, a=500, ct=0, dt=1000;

static inline void initTimer1(void)
{
  TCCR1 |= (1 << CTC1);  // clear timer on compare match
  TCCR1 |= (1 << CS13) | (1 << CS12) | (1 << CS11); //clock prescaler 8192
  OCR1C = 255; // compare match value
  TIMSK |= (1 << OCIE1A); // enable compare match interrupt
}

ISR(TIMER1_COMPA_vect)
{
  int ct1 = millis();
  y = analogRead(adc_p2); if(y<1) y=1; if(y>999) y=999;
  u = control(y);
  analogWrite(outPin, u/4); 
  digitalWrite(ledPin, digitalRead(ledPin) ^ 1);  //toggle LED
  ct1 = ct1 - millis();
  ct = ct1;
}

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(outPin, OUTPUT);
  DigiUSB.begin();
  DigiUSB.println();

  if (useTimer1) {
    initTimer1();        // initialize timer registers
    sei();               // enable interrupts
  }
}

void loop() {
  DigiUSB.print(millis()/100);
  DigiUSB.print('\t');
  DigiUSB.println(ct);
  if (dt>0) DigiUSB.delay(dt);
  else DigiUSB.refresh();
}

int control(int y) { 
  int out;
  if (p<=0) out = a;
  else out = int(100.0*float(w-y)/float(p)) + a;
  if(out<0) out=0; if(out>999) out=999;
  return out;
}

7
Hi All,

I am new to Arduino environment, I was trying to use 128x64 oled with the digispark.

But I am unsure how to print a variable in it, I do see the text that can be entered as

Code: [Select]
   enum {BufSize=9}; // If a is short use a smaller number, eg 5 or 6
  char buf[BufSize];
  oled.clear(); //all black
  oled.setCursor(0, 0); //top left
  oled.setFont(FONT8X16);
  oled.print(F("Voltage")); //wrap strings in F() to save RAM!
  oled.setFont(FONT6X8);
  oled.setCursor(0, 2); //two rows down because the 8x16 font takes two rows of 8
  volt = analogRead(analogPin);
  volt=100;
  snprintf (buf, BufSize, "%d", volt);
  oled.println(buf); //println will move the cursor 8 or 16 pixels down (based on the front) and back to X=0

How can I print the value of the voltage that I read from the analog pin?

Thanks in Advance.
8
I feel your pain... I am trying to use this to feed data into a Pi and under Windows I can't do any debugging since it never completes the USB connection.  I have several of these and really need this to work.

Same problem here. Any success yet?

I am sad because a developer does not appear to be able to help with these problems, I believe it is something simple related to data flow timing, something that either goes too slow and expires the time of communication with the USB of the computer or very fast that the USB computer controller can not interpret properly !!!

I tried to modify several parameters in the DigiCDC files, but I did not succeed ...

If any of you two get something please share with me !!!

Hugs
9
Digispark Projects / Re: Genie Garage Door opener using Digispark Pro
« Last post by DaveFromRI on December 05, 2017, 05:01:40 am »
Well, I'm going to wrap up this thread with a final post.

The code presented above (V3) continues to work perfectly, and I'm happy with the "two-attempts-to-close" limitation. Without a sensor to detect when the door is open, it is the best solution.

HINDSIGHT THOUGHTS:
1. A "Door Open" sensor would have made life tremendously simpler, resulting in a more accurate door controller. Oh well.
2. I don't regret not having Internet access, because for most of us, the garage door is so simple, such access is over-kill. What's next, Internet access for our toilets? {A JOKE FOLKS!}
3. Related to #2 above, the coded intelligence to try to close the door two times before quitting seems very sufficient, so I'm okay with that.
4. My existing code forces a 4-digit access code, and for the most part, I don't regret it. Yea, it will force people who would want one or two digits codes from getting what they want, but let's face it, security trumps convenient (at least in this case). Besides, if someone wants a two or three digit code, the raw source is provided by me for you to adjust as you see fit (but without me agreeing with such a decision).
5. I wish I had coded for a 5-digit open code, to eliminate the need to first enter your 4-digit open code, and then "OPEN" to force the door to stay open. Just yesterday I needed to test an ODBC monitoring tool and after opening the door, I forgot to press "OPEN" (resulting in the door closing after 3 minutes).
It would have been better if I had allowed for a 5-digit code (maybe the 4 digit open code plus "O" for "Open"), which would then force the door to stay open indefinitely.

Anyway, this is my final contribution to this project, and I want to sincerely thank exeng for his contribution, and also thanks to those who took the time to read my post, but didn't feel it necessary to reply {I'm sure you're out there, and I understand}.

KEEP ON CODING!  :-)
10
Oak Support / Re: Final Goodbye
« Last post by PeterF on December 03, 2017, 06:27:56 pm »
Yeah, the hardware is one of the best, if not the best, ESP8266 boards you can get, but the firmware, particularly the particle side of things has rendered it quite unstable. Having said that, I ran one as a simple temperature sensor with deepsleep, with manual wifi config, and didn't have any issues for a good six months. I'm actually having more trouble with another one that is running the current stable ESP8266 Arduino core, TFT display and thinkspeak connection... I'm certain the thingspeak library is a POS and keeps locking up on the ESP8266 every 2-3 weeks :-/ Just haven't had a chance to work out what my other options are for reading from thingspeak.
Pages: [1] 2 3 ... 10