Everything posted by Festivejelly
-
Ebike derestrictor
It could well be that your attiny85 is rebooting. Maybe its not able to draw enough power?
-
Ebike derestrictor
Hrm I havnt tried this for a long time but I did have a solution that worked for me. Let me have a dig around my hard disk see if I still have that code.
-
Dealing with Yamaha lock nut
FYI check this video out, its in german but it shows how you remove the spider
-
Dealing with Yamaha lock nut
Ahhh yes. I can see it has "tighten" written on it. Ill just do the opposite way then
-
Dealing with Yamaha lock nut
Good to know, thanks for the tip, ill be careful
-
Dealing with Yamaha lock nut
Its a completely different shape to the bosch one. Im going to see if i can get my hands on a 35mm socket for torque wrench. Its basically just a hex nut by the looks of it.
-
Dealing with Yamaha lock nut
So I removed my cranks from my haibike all mtn sl 2016 and discovered theres some sort of lock ring stopping me taking the chain ring off. It looks to be roughly 1.4 inches in diameter. Does anyone know how the heck I can remove those so I can replace my damaged chain ring? Its sort of recessed into the spider, which means I cant get a wrench onto it
-
Ebike derestrictor
Awesome! Let me know if you need any of the 3d files. I'll be uploading them to thingiverse soon and ill post the link there when im done. I'll also update my first post with my new design.
-
Ebike derestrictor
PS theres no need to use the internal pullup resistor with a reed switch so as you can see ive commented that line out.
-
Ebike derestrictor
Arduino code: // Nicholas John // 22 May 2017 // // ATMEL ATTINY 85 // // +-\/-+ // (PCINT5/RESET/ADC0/dW) PB5 1| |8 Vcc // (PCINT3/XTAL1/OC1B/ADC3) PB3 2| |7 PB2 (SCK/USCK/SCL/ADC1/T0/INT0/PCINT2) // (PCINT4/XTAL2/CLKO/OC1B/ADC2) PB4 3| |6 PB1 (MISO/DO/AIN1/OC0B/OC1A/PCINT1) // GND 4| |5 PB0 (MOSI/DI/SDA/AIN0/OC0A/OC1A/AREF/PCINT0) // +----+ #include <avr/sleep.h> // Sleep Modes #include <avr/power.h> #include <elapsedMillis.h> const int hallPin = 2; // the number of the hall effect pin const int magnetPin = 1; // the number of the magnet pin const long debouncing_time = 15; //Debouncing Time in Milliseconds // variables will change: volatile int hallState = 0; // variable for storing the hall counter volatile unsigned long last_micros; elapsedMillis timer; void setup() { pinMode(magnetPin, OUTPUT); pinMode(hallPin, INPUT); //digitalWrite(hallPin, HIGH); // Attach an interrupt to the ISR vector attachInterrupt(0, pin_ISR, RISING); //default interupt pin is always 0 on attiny85 (physical pin 7) timer = 0; } void sleep() { GIMSK |= _BV(PCIE); // Enable Pin Change Interrupts PCMSK |= _BV(PCINT2); // Use PB2 as interrupt pin ADCSRA &= ~_BV(ADEN); // ADC off set_sleep_mode(SLEEP_MODE_PWR_DOWN); // replaces above statement sleep_enable(); // Sets the Sleep Enable bit in the MCUCR Register (SE BIT) sei(); // Enable interrupts sleep_cpu(); // sleep cli(); // Disable interrupts PCMSK &= ~_BV(PCINT2); // Turn off PB2 as interrupt pin sleep_disable(); // Clear SE bit ADCSRA |= _BV(ADEN); // ADC on sei(); // Enable interrupts } // sleep void loop() { if(hallState>1) { digitalWrite(magnetPin,HIGH); delay(20); digitalWrite(magnetPin,LOW); hallState=0; } if(timer>=30000) { sleep(); } } void pin_ISR() { if((long)(micros() - last_micros) >= debouncing_time * 1000) { timer=0; hallState++; last_micros = micros(); } } The above includes functionality to sleep when its not detected a magnet in 30 seconds. this is there to save power. When its in sleep mode the device draws about 20 micro amps, which is a tiny amount. Also includes debounce code to handle bouncing that you'll get using a reed switch.
-
Ebike derestrictor
Some images here, note the attiny prototype is way smaller in size than the solution that uses Nand gates and a flipflop.
-
Ebike derestrictor
Sure thing Geoff. Here is the arduino code: // Speed Derestrictor // Nicholas John // 22 May 2017 // // ATMEL ATTINY 85 // // +-\/-+ // (PCINT5/RESET/ADC0/dW) PB5 1| |8 Vcc // (PCINT3/XTAL1/OC1B/ADC3) PB3 2| |7 PB2 (SCK/USCK/SCL/ADC1/T0/INT0/PCINT2) // (PCINT4/XTAL2/CLKO/OC1B/ADC2) PB4 3| |6 PB1 (MISO/DO/AIN1/OC0B/OC1A/PCINT1) // GND 4| |5 PB0 (MOSI/DI/SDA/AIN0/OC0A/OC1A/AREF/PCINT0) // +----+ #include <avr/sleep.h> // Sleep Modes #include <avr/power.h> #include <elapsedMillis.h> const int hallPin = 2; // the number of the hall effect pin const int ledPin = 1; // the number of the LED pin const long debouncing_time = 15; //Debouncing Time in Milliseconds // variables will change: volatile int hallState = 0; // variable for storing the hall counter volatile unsigned long last_micros; elapsedMillis timer; void setup() { pinMode(ledPin, OUTPUT); pinMode(hallPin, INPUT); //digitalWrite(hallPin, HIGH); // Attach an interrupt to the ISR vector attachInterrupt(0, pin_ISR, RISING); //default interupt pin is always 0 on attiny85 (physical pin 7) timer = 0; } void sleep() { GIMSK |= _BV(PCIE); // Enable Pin Change Interrupts PCMSK |= _BV(PCINT2); // Use PB2 as interrupt pin ADCSRA &= ~_BV(ADEN); // ADC off set_sleep_mode(SLEEP_MODE_PWR_DOWN); // replaces above statement sleep_enable(); // Sets the Sleep Enable bit in the MCUCR Register (SE BIT) sei(); // Enable interrupts sleep_cpu(); // sleep cli(); // Disable interrupts PCMSK &= ~_BV(PCINT2); // Turn off PB2 as interrupt pin sleep_disable(); // Clear SE bit ADCSRA |= _BV(ADEN); // ADC on sei(); // Enable interrupts } // sleep void loop() { if(hallState>1) { digitalWrite(ledPin,HIGH); delay(20); digitalWrite(ledPin,LOW); hallState=0; } if(timer>=30000) { sleep(); } } void pin_ISR() { if((long)(micros() - last_micros) >= debouncing_time * 1000) { timer=0; hallState++; last_micros = micros(); } } This is using a reed switch as a opposed to a hall effect sensor. A reed switch is a normally open circuit, and the circuit doesnt get closed until the magnet comes near the reed switch. A hall effect sensor on the other hand is normally high and gets pulled low when a magnet is near. I prefer the reed switch as it saves energy when the circuit is not in use. As you can see ive included some code to put the AtTiny85 to sleep, so it draws microamps. It then gets woken when a magnet activates the reed switch. The magnet itself is just a steel bolt wrapped in 0.23 mm enamelled copper wire winding from only left to right (not both ways, all the coils have to be doing 1 direction in order to make an effective magnet). Ive attached some pictures of my old circuit that uses a flip flip and nand gates and also my new one that uses the arduino style attiny85
-
Ebike derestrictor
Ah nice thanks for the pics. I decided to go ahead and make my own magnet. I tweaked my code a bit and its only using 20 milliamps now. I put in a 850mah lipo with a recharging circuit so I think thatle do me I would have liked to have used the relays as ive got 10 or so of them kicking around, but they are a different type to yours so I think the field pattern ends up being too weak at the mounting point. My new magnet is a steel bolt with thin enamelled wire. I basically turn it on for 20ms each power up. Works a treat now.
-
Ebike derestrictor
Hrm I tried a 5v relay, how did you position it over the sensor? I couldnt get it to trigger with my relay, even with it stripped down.
-
Ebike derestrictor
But then i'm modifying my bike right? I want a non intrusive way of de restricting. This way it can be easily removed. Theres a pull up resistor and capacitor built onto the hall effect sensor board.
-
Ebike derestrictor
Very good! Sounds like you've got a great solution going on there. I was unable to get the hall sensor on my bike to trigger with a 5v relay so im stuck with the electromagnet Maybe i'll try directing the fields. RE The arduino, you could easily control the whole circuit using an ATTiny85 and program it using the arduino IDE. What ive done with mine is put it into sleep mode if it doesnt detect a magnet in 30 seconds. This basically turns the whole thing off without the need for a power switch.
-
Ebike derestrictor
Thats my crappy diagram, if you expand it you'll see the wire is a different colour. The base isnt meant to be attached to the 5v.
-
Ebike derestrictor
So you can use a boost circuit to boost a 3.7v 18650 to 5v. They are pretty efficient these days to about 90%. Flip flips are the lowest power solution but if you wanted a simpler circuit you could use an AtTiny85 which consumes around 5ma of current. The great thing about the AtTiny85 is you can program it with the arduino IDE but also you can put it in sleep mode so it will literally be drawing micro amps. I'll upload a schematic when I get home. The one thing I havnt found an easy solution for yet is the electromagnet. I'm still winding my own, it seems 5v relays arnt quite powerful enough to trigger the hall effect sensor on my bike.
-
Ebike derestrictor
- Ebike derestrictor
So here's what the circuit looks like. When I get a bit more time i'll sort a proper schematic out. But based on this diagram you should be able to work it out. The VCC needs 5v. I havnt bothered building in a switch since the whole circuit takes such little power its not worth it. Here's some links to the IC's I used: 4013 D-Type Flip Flop http://www.electroschematics.com/6509/4013-datasheet/ 4093 NAND http://www.electroschematics.com/6454/ic-4093-datasheet/- Ebike derestrictor
PS the hall sensor I use takes hardly any power at all. My multimeter cant even detect it because its so low.- Ebike derestrictor
I made a new design that uses a 4093 NAND gate IC and a 4013 D-Type flipflop IC. These uses tiny amounts of power. You still need an electromagnet as a reed switch or relay doesnt generate a big enough field. I've refined my electromagnet design by using a thinner wire (0.15mm) and making more coils. Every pulse is about 80 milliamps. I power my design with a 500mah lipo that can be recharged via USB. Im going to experiment with more coils in the magnet to raise its resistance which will lower the amount of current it draws per pulse. Its getting a lot more technical than I thought it would. But i'm on the cusp of figuring out how big a field my bike needs. To make a coil is pretty easy. I use an iron bolt and use a drill to wrap the wire around.- Arrrg where do I get a new battery?
400 - 500 quid is about what id expect to pay tbh. I've not been particularly good to mine. But considering the price of cells 700 quid is a complete rip off.- Arrrg where do I get a new battery?
Ah I just saw the ebay, I assumed it was a no brand one. Looks like they've custom built that themselves. Must be using their own BMS. Makes sense really.- Arrrg where do I get a new battery?
Cheers. Bloody hell thats expensive! I wonder how many cells are inside it. - Ebike derestrictor
Back to top