Skip to main content

Topics

This section allows you to view all Topics made by this member. Note that you can only see Topics made in areas you currently have access to.

Topics - JohnLittle

1
General discussion / Raspberry Pi camera test (macro mode)
Hello,

I altered the focal depth on my raspberry pi camera (aka twisting the lens anticlockwise about 180 degrees) and thought you might be interested in some sample pics.

Oblique white light vs Ambient light (full camera resolution, 2592x1944).

Here's a 1:1 crop of the LED illuminated scene:
[attachment=0]
I was encouraged by this report. If I may quote:
Quote
The glue that is used is quite brittle, so you can break it out of place with care, and the lens unit will then move freely on the screw thread. We used pliers for the initial unscrewing, but we have heard from people in the community who have pressed down on the top of the lens unit with a soft pencil eraser, and twisted, which has applied enough gentle force to snap the dried glue.
However, that was not my experience. At all. Just for reference, I bought my camera module in September 2014 and the lens was very tightly glued in.
 
This worked for me:
  • Separate the camera from its PCB by gentle lifting and twisting
  • Put the camera in a vice, lens facing up
  • You need a lens wrench! File a triangular hole of appropriate size/shape in a metal strip (the small hole at the bottom of a PC back mounting bracket was the perfect starting point for me)
  • Clean metal shavings with alcohol
  • Unscrew lens with lens wrench
Success! If you try this or have a better method, do let me know. Maybe you won't need to pry the camera of its PCB. I just didn't have enough purchase any other way.

Edit: Added photo of the setup and lens wrench. See Imgur Album.
2
Arduino / Using a USBASP v2.0 as a cheap ATmega8 Arduino platform
Hello list!

tl;dr: Buy two USBASP v2.0 programmers, follow these instructions and use one to program the other through the Arduino IDE.

[hr:][/hr:]
Edit 2016-01-15 Simplified instructions for the 1.6.x IDE.

First, we now have a method of installing digitally signed Windows libusb drivers for USBASP, thanks to Ray's efforts (link here). This is particularly useful if you are using Windows 8 or 8.1, there is no need to disable signature enforcement.

Then, all the hard work of setting a USBASP board in the Arduino IDE now comes down to adding the following URL into the IDE's preferences panel in Additional Boards Manager URLs. Thank you James!  (detailed instructions).

In the IDE, once the DIY boards are installed in the boards manager, you can select Board "Atmega8/A". Use bootloader NO, processor speed 8MHz (default), processor version Atmega8A and programmer USBASP.

With these, I was able to upload the blink sketch below using ctrl-shift-U (don't forget to close JP2 on the target USBASP).

[attachment=0]

You may still need to update the firmware on the USBASP (instructions below).
[hr:][/hr:]

I finally got round playing with my AVRASP v2.0 boards. The ones Sleepwalker3 mentioned. Thanks mate!

I bought three USBASP v2.0 on ebay for under £1.50 each. They each came with a short cable (5x2 sockets at each end). However, they do not come with the JP2 header soldered on. Solder it or you won't be able to re-flash the on-board ATmega8 chip. JP3 on the other hand has been deprecated. It may still have some use in your own projects. You decide!

Then download some software (this is for Windows):

To use the USBASP programmer with the Arduino IDE, you will need to download the driver, latest firmware and WinAVR-20100110-install.

Small setback, my boards came pre-installed with an older firmware, so I needed to upload the latest. This is to avoid complaints from the Arduino IDE. avrdude: warning: cannot set sck period. please check for usbasp firmware update.

So let's do this, shall we? Link two boards using one of the provided cables. Close JP2 on the board you intend to program. The other board, and ONLY the other board, goes into the USB port. This is the board that will be used as the programmer.

Type the following command in the appropriate folder.

Code: [Select]
D:Downloadsusbasp.2011-05-28binfirmware>avrdude -c usbasp -p m8 -U flash:w:usbasp.atmega8.2011-05-28.hex

Upon success, the R LED on the programmed board will light-up after the new firmware has been uploaded. Unplug, move the J2 jumper to other other board, swap the boards and repeat.

Quote
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x1e9307
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

        To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "usbasp.atmega8.2011-05-28.hex"
avrdude: input file usbasp.atmega8.2011-05-28.hex auto detected as Intel Hex
avrdude: writing flash (4700 bytes):

Writing | ################################################## | 100% 2.01s



avrdude: 4700 bytes of flash written
avrdude: verifying flash memory against usbasp.atmega8.2011-05-28.hex:
avrdude: load data flash data from input file usbasp.atmega8.2011-05-28.hex:
avrdude: input file usbasp.atmega8.2011-05-28.hex auto detected as Intel Hex
avrdude: input file usbasp.atmega8.2011-05-28.hex contains 4700 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.68s



avrdude: verifying ...
avrdude: 4700 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Then we need to add a section in boards.txt for the USBASP v2.0 board. My location was: "C:Program Files (x86)Arduinohardwarearduinoavrboards.txt"

I added the following section at the end of the file:

Code: [Select]
##############################################################
usbasp.name=USBASP v2.0
usbasp.upload.protocol=arduino
usbasp.upload.maximum_size=7680
usbasp.upload.speed=115200
usbasp.upload.tool=avrdude

usbasp.bootloader.low_fuses=0xef
usbasp.bootloader.high_fuses=0xc9
usbasp.bootloader.path=optiboot
usbasp.bootloader.file=optiboot_atmega8.hex
usbasp.bootloader.unlock_bits=0x3F
usbasp.bootloader.lock_bits=0x0F
usbasp.bootloader.tool=avrdude

usbasp.build.mcu=atmega8
usbasp.build.f_cpu=12000000L
usbasp.build.core=arduino
usbasp.build.variant=standard
##############################################################

Almost there! Run the Arduino IDE and select the new "USBASP v2.0" from the tools / board menu.

My blink code follows:
Code: [Select]
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the Uno and
  Leonardo, it is attached to digital pin 13. If you're unsure what
  pin the on-board LED is connected to on your Arduino model, check
  the documentation at http://arduino.cc

  This example code is in the public domain.

  modified 8 May 2014
  by Scott Fitzgerald
 */

#define PIN_LED 14

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(PIN_LED, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(PIN_LED, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(500);              // wait for a second
  digitalWrite(PIN_LED, LOW);    // turn the LED off by making the voltage LOW
  delay(500);              // wait for a second
}

The LEDs are connected to PC0/ADC0 (G) and PC1/ADC1 (R). These are Digital Pin 14 and 15 (can someone explain where these values come from?).

To upload the code from the Arduino IDE, use file / upload using programmer (or ctrl-shift-u). If successful, LED G should now be blinking at 1 pulse a second.

Hope this helps! Any comments / additions / corrections appreciated.

edit: fuse values in the boards.txt section.