author

jm-l

Inbox View Profile
12CommentsFrance
It’s me
  • How to Build a Giant Hidden Shelf Edge Clock

    it really depends on you power supply. pure USB (old style, non smart) won't deliver more than 500mA to the system. So indeed that will impact how much power the system gets and if the draw is too much, it likely won't even turn on. I've not looked but I'm sure you can decide (a setBrightness() call) in the code to make all the leds not to bright to stay within the capability of the power supply.

    View Instructable »
  • How to Build a Giant Hidden Shelf Edge Clock

    indeed, would be a nice addition. It's not overly complex to do since it's just about extending the shelf with to gain a full extra "7 segment display" and a bit of modification in the code to allow for 24h representation.

    on the comment "To use just USB for power, instead of mains"Author is using WS2821B 'Neopixels' LEDs. At full brightness (if you were to choose so) you need a 20 mA budget... (if you were to pick a RGB strip, that's 50 to 60mA per LED)There are 23 lengths of 9 LEDs = 207 LEDs (not counting the shelves lighting) so if you want to be able to turn them full on, you need a power supply that can deliver at least 4 amps !The author picked a 2.1 amps 5V power supply, so LEDs will be only at half brightness and because it's not alway 18:88 which is the max current draw, most of the time you'll do better in terms of brightnessBut if you go for pure standard USB, you get a 500mA max budget and LEDs would 4 times worse...

    View Instructable »
  • How to Build a Giant Hidden Shelf Edge Clock

    Fair point. You are right, from what I see in the build-up, the first column can indeed only a "ONE" so I guess this clock is meant for 12 hours type of display. No big deal - most of us can tell if it's morning or evening :) — and it keeps the shelf to a reasonable width...

    View Instructable »
  • jm-l commented on cornelam's instructable I2C Between Arduinos5 weeks ago
    I2C Between Arduinos

    well there is also the fact that x is an int (2 or 4 bytes depending on the architecture) and that the code is just using write(x) to send that data... it will only send the first byte of the data.. that works here because x is reset when it reaches 6 so the value always fit in the least significant byte....so not a great example...

    View Instructable »
  • jm-l commented on Joe Palmer's instructable Arduino Laser-based Timing System7 weeks ago
    Arduino Laser-based Timing System

    As Joe Palmer used the millis() function to capture time, it will report time to the millisecond. what impacts the timing: the LDR response time can be between 2 and 50 ms... so that's quite an error there but "with a bit of luck" if you have the same bias at the top and bottom, you still measure a relatively correct duration (difference between the two triggers). As noted by PeterD304 using a photodiode you could get a better response time it depends on the diode typically 30 psec to 2 msec. A phototransistor (a photodiode with some internal amplification) has longer response times like 20 nsec to 1 msec depending on what you buy. The other big piece is the use of digitalRead() function to detect the trigger. This is not super fast, but executes still in roughly 4.9 microseco...

    see more »

    As Joe Palmer used the millis() function to capture time, it will report time to the millisecond. what impacts the timing: the LDR response time can be between 2 and 50 ms... so that's quite an error there but "with a bit of luck" if you have the same bias at the top and bottom, you still measure a relatively correct duration (difference between the two triggers). As noted by PeterD304 using a photodiode you could get a better response time it depends on the diode typically 30 psec to 2 msec. A phototransistor (a photodiode with some internal amplification) has longer response times like 20 nsec to 1 msec depending on what you buy. The other big piece is the use of digitalRead() function to detect the trigger. This is not super fast, but executes still in roughly 4.9 microseconds so well within a reasonable timing to report the duration in ms. So if you want to do better than ms, you'll have to move to a fast response time photodiode, and you could exchange millis() with micros() and would capture time at micro-second level. In that case though, the digitalRead() function and active wait while() would introduce a cost that would become meaningful. So if you were to do this, then the code would have to be switched to use interrupts and you could probably be accurate at less than 5 microsecondif you keep the same code and move to a good photodiode + using micros() then only keep a tenth of a ms as accuracy (ie you round up or down at the closest 100 microsecond)

    As Joe Palmer used the millis() function to capture time, it will report time to the millisecond. what impacts the timing: the LDR response time can be between 2 and 50 ms... so that's quite an error there but "with a bit of luck" if you have the same bias at the top and bottom, you still measure a relatively correct duration (difference between the two triggers). As noted by PeterD304 using a photodiode you could get a better response time it depends on the diode typically 30 psec to 2 msec. A phototransistor (a photodiode with some internal amplification) has longer response times like 20 nsec to 1 msec depending on what you buy. The other big piece is the use of digitalRead() function to detect the trigger. This is not super fast, but executes still in roughly 4.9 microse...

    see more »

    As Joe Palmer used the millis() function to capture time, it will report time to the millisecond. what impacts the timing: the LDR response time can be between 2 and 50 ms... so that's quite an error there but "with a bit of luck" if you have the same bias at the top and bottom, you still measure a relatively correct duration (difference between the two triggers). As noted by PeterD304 using a photodiode you could get a better response time it depends on the diode typically 30 psec to 2 msec. A phototransistor (a photodiode with some internal amplification) has longer response times like 20 nsec to 1 msec depending on what you buy. The other big piece is the use of digitalRead() function to detect the trigger. This is not super fast, but executes still in roughly 4.9 microseconds so well within a reasonable timing to report the duration in ms. So if you want to do better than ms, you'll have to move to a fast response time photodiode, and you could exchange millis() with micros() and would capture time at micro-second level. In that case though, the digitalRead() function and active wait while() would introduce a cost that would become meaningful. So if you were to do this, then the code would have to be switched to use interrupts and you could probably be accurate at less than 5 microsecondif you keep the same code and move to a good photodiode + using micros() then only keep a tenth of a ms as accuracy (ie you round up or down at the closest 100 microsecond)

    As Joe Palmer used the millis() function to capture time, it will report time to the millisecond. what impacts the timing: the LDR response time can be between 2 and 50 ms... so that's quite an error there but "with a bit of luck" if you have the same bias at the top and bottom, you still measure a relatively correct duration (difference between the two triggers). As noted by PeterD304 using a photodiode you could get a better response time it depends on the diode typically 30 psec to 2 msec. A phototransistor (a photodiode with some internal amplification) has longer response times like 20 nsec to 1 msec depending on what you buy. The other big piece is the use of digitalRead() function to detect the trigger. This is not super fast, but executes still in roughly 4.9 microseco...

    see more »

    As Joe Palmer used the millis() function to capture time, it will report time to the millisecond. what impacts the timing: the LDR response time can be between 2 and 50 ms... so that's quite an error there but "with a bit of luck" if you have the same bias at the top and bottom, you still measure a relatively correct duration (difference between the two triggers). As noted by PeterD304 using a photodiode you could get a better response time it depends on the diode typically 30 psec to 2 msec. A phototransistor (a photodiode with some internal amplification) has longer response times like 20 nsec to 1 msec depending on what you buy. The other big piece is the use of digitalRead() function to detect the trigger. This is not super fast, but executes still in roughly 4.9 microseconds so well within a reasonable timing to report the duration in ms. So if you want to do better than ms, you'll have to move to a fast response time photodiode, and you could exchange millis() with micros() and would capture time at micro-second level. In that case though, the digitalRead() function and active wait while() would introduce a cost that would become meaningful. So if you were to do this, then the code would have to be switched to use interrupts and you could probably be accurate at less than 5 microsecondif you keep the same code and move to a good photodiode + using micros() then only keep a tenth of a ms as accuracy (ie you round up or down at the closest 100 microsecond)

    As Joe Palmer used the millis() function to capture time, it will report time to the millisecond. what impacts the timing: the LDR response time can be between 2 and 50 ms... so that's quite an error there but "with a bit of luck" if you have the same bias at the top and bottom, you still measure a relatively correct duration (difference between the two triggers). As noted by PeterD304 using a photodiode you could get a better response time it depends on the diode typically 30 psec to 2 msec. A phototransistor (a photodiode with some internal amplification) has longer response times like 20 nsec to 1 msec depending on what you buy. The other big piece is the use of digitalRead() function to detect the trigger. This is not super fast, but executes still in roughly 4.9 microsec...

    see more »

    As Joe Palmer used the millis() function to capture time, it will report time to the millisecond. what impacts the timing: the LDR response time can be between 2 and 50 ms... so that's quite an error there but "with a bit of luck" if you have the same bias at the top and bottom, you still measure a relatively correct duration (difference between the two triggers). As noted by PeterD304 using a photodiode you could get a better response time it depends on the diode typically 30 psec to 2 msec. A phototransistor (a photodiode with some internal amplification) has longer response times like 20 nsec to 1 msec depending on what you buy. The other big piece is the use of digitalRead() function to detect the trigger. This is not super fast, but executes still in roughly 4.9 microseconds so well within a reasonable timing to report the duration in ms. So if you want to do better than ms, you'll have to move to a fast response time photodiode, and you could exchange millis() with micros() and would capture time at micro-second level. In that case though, the digitalRead() function and active wait while() would introduce a cost that would become meaningful. So if you were to do this, then the code would have to be switched to use interrupts and you could probably be accurate at less than 5 microsecondif you keep the same code and move to a good photodiode + using micros() then only keep a tenth of a ms as accuracy (ie you round up or down at the closest 100 microsecond)

    View Instructable »
  • jm-l commented on Joe Palmer's instructable Arduino Laser-based Timing System7 weeks ago
    Arduino Laser-based Timing System

    great work , thanks for sharing.a few constructive notes:---------------------------------------------- I noticed the use of pin #1 for one of the laser. whilst it's not a problem in your setup, this pin is used for Serial connection and will prevent anyone extending your code to use Serial.print() for debugging purpose. I would suggest to move the lasers to pin 2 and 3 (give them names as well, that make code more readable and easy to change) this way if you want to benefit from interrupts, that would be ready to go :-)---------------------------------------------- you use also pin13 for one of your LDR. Pin 13 on your UNO is connected to the onboard LED. as you are not short of pins, you could keep that one free in case you need to blink a led or something. --------------------------...

    see more »

    great work , thanks for sharing.a few constructive notes:---------------------------------------------- I noticed the use of pin #1 for one of the laser. whilst it's not a problem in your setup, this pin is used for Serial connection and will prevent anyone extending your code to use Serial.print() for debugging purpose. I would suggest to move the lasers to pin 2 and 3 (give them names as well, that make code more readable and easy to change) this way if you want to benefit from interrupts, that would be ready to go :-)---------------------------------------------- you use also pin13 for one of your LDR. Pin 13 on your UNO is connected to the onboard LED. as you are not short of pins, you could keep that one free in case you need to blink a led or something. ---------------------------------------------- the two "delay(100);" when waiting for the laser are not necessary---------------------------------------------- digitalRead() returns HIGH or LOW. Yes it's indeed 0 and 1 behind the scene, but for readability it's better to stick to HIGH and LOW in the code---------------------------------------------- for anything dealing with time and millis(), you need to use unsigned long, not an int. Your int on your Arduino Uno is limited to 32767 so after 33 seconds your code will start behaving very weirdly. so you need to declareunsigned long start_time = 0;unsigned long stop_time = 0;unsigned long total_time = 0;---------------------------------------------- at the end of the code instead of your infinite loop (which usually is coded as while(true);) you could wait for the user to press select to start a cycle again :) ---------------------------------------------- Note that you don't need really intermediary variables for your while(). instead of doing while (light_sense_1 == 0) { light_sense_1 = digitalRead(12); // LDR1 indefinitely until laser break is detected on LDR 1 }you can just dowhile (digitalRead(12) == LOW); // poll LDR1 indefinitely until laser break is detected on LDR1(or better if you had defined pin 12 with a name, the code will be self documenting;const byte LDR1_Pin = 12;...while (digitalRead(LDR1_Pin) == LOW) ; ---------------------------------------------so the code could become something like:/* Created by Joe Palmer 16/04/2019 Function: This program will power two laser dot projection units. Laser dots are aimed at LDR unit to create light gates. Total travel time between the two light gates is measured and displayed on LCD screen*/// Using LiquidCrystal library#include <LiquidCrystal.h>// select the pins used on the LCD panelLiquidCrystal lcd(8, 9, 4, 5, 6, 7);// define some values used by the panel and buttons#define btnRIGHT 0#define btnUP 1#define btnDOWN 2#define btnLEFT 3#define btnSELECT 4#define btnNONE 5unsigned long start_time = 0;unsigned long stop_time = 0;const byte laser1Pin = 1; // would be better on 2 as 1 is used by the Serial port which is convenient for debugconst byte laser2Pin = 2; // would be better on 3const byte ldr1Pin = 12;const byte ldr2Pin = 13; // would be better on 10 to keep the built in LEDconst byte keyboardPin = A0;// read the buttonsbyte read_LCD_buttons(){ int adc_key_in = analogRead(keyboardPin); // read the value from the sensor // my buttons when read are centered at these valies: 0, 144, 329, 504, 741 // we add approx 50 to those values and check to see if we are close if (adc_key_in > 1500) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result if (adc_key_in < 50) return btnRIGHT; if (adc_key_in < 195) return btnUP; if (adc_key_in < 380) return btnDOWN; if (adc_key_in < 500) return btnLEFT; if (adc_key_in < 700) return btnSELECT; return btnNONE; // when all others fail, return this...}void setup(){ lcd.begin(16, 2); // start the library lcd.clear(); // clear and position cursor at 0,0 lcd.print(F("Initialising")); // print a simple message lcd.setCursor(0, 1); // move cursor to second line "1" lcd.print(F("select to start")); // prompt user to press select button pinMode(laser1Pin, OUTPUT); //Laser1 pinMode(laser2Pin, OUTPUT); //Laser2 pinMode(ldr1Pin, INPUT); //LDR1 pinMode(ldr2Pin, INPUT); //LDR2}void loop(){ while (read_LCD_buttons() != btnSELECT) ; // read the buttons indefinetely until user presses select digitalWrite(laser1Pin, HIGH); //Turn on laser 1 digitalWrite(laser2Pin, HIGH); // Turn on laser 2 lcd.clear(); //clear LCD lcd.print(F("waiting laser")); while (digitalRead(ldr1Pin) == HIGH || digitalRead(ldr2Pin) == HIGH) ; // read both LDRs indefinitely until laser is detected on both. // no light is 4.8V so HIGH, light detected is 0V so LOW lcd.clear(); //clear LCD lcd.print("armed"); // while (digitalRead(ldr1Pin) == LOW) ; // poll LDR1 indefinitely until laser break is detected on LDR 1 start_time = millis(); lcd.clear(); //clear LCD lcd.print(F("timing")); // while (digitalRead(ldr2Pin) == LOW) ; // poll LDR2 indefinitely until laser break is detected on LDR 2 stop_time = millis(); lcd.clear(); //clear LCD lcd.print("time recorded"); // lcd.setCursor(0, 1); // move cursor to bottom line lcd.print(stop_time - start_time); // // wait until user presses select again for next attempt while (read_LCD_buttons() != btnSELECT) ;}hope this helps

    View Instructable »