Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Sensors / Re: Differential Sensing with Arduino on: February 24, 2014, 09:20:40 pm
For some reason the page's information for those library links are not working. Is there any possibility that I could get that library another way?

I ended up manipulating the ADC register manually as this library didn't work for the Tiny 84, though you have to ensure you do everything in the right order, including waiting a while after enabling the ADC/changing some bits for it to stabilise. It's not too difficult though.
2  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: September 18, 2013, 06:31:32 pm
For anyone who is using the new Xcode 5 released today, embedXcode does a check to verify the version of Xcode that's running and fails since it's not 4.x. Since there are few internal changes in Xcode's build process, you can skip the check by adding a # infront of lines 548 and 549 in Makefiles/Step2.mk.

Code:
# @if [ -f $(CURDIR)/About/About.txt ]; then $(CAT) $(CURDIR)/About/About.txt; fi;
# @if [ -f $(UTILITIES_PATH)/embedXcode_check ]; then $(UTILITIES_PATH)/embedXcode_check; fi

Also it's probably best to keep these compiled binaries disabled since the source code is unknown, and embedXcode_check gets your serial number then chats to a PHP script. Why do you need people's serial numbers Avenue33, without their permission? That is rather unscrupulous, and there's no reason I can see that you need a binary since everything can be done within the makefile, including version checking.

Code:
imac:~ Elijah$ strings /Users/Elijah/Dropbox/test/Heating3.1/Utilities/embedXcode_check
@NSt3__113basic_fstreamIcNS_11char_traitsIcEEEE
NSt3__113basic_filebufIcNS_11char_traitsIcEEEE
/Makefiles/Step1.mk
grep -e '.*USER_FLAG.*:=' "
true
grep -e '.*TEMPLATE.*:=' "
/Makefiles/Step2.mk
grep -e '.*RELEASE_NOW.*:=' "
PROJECT_FILE_PATH
PROJECT_NAME
ioreg -l | awk '/IOPlatformSerialNumber/ { print $4;}'
open "
/Utilities/serial.txt
 ports available
====
 ====
: select one.
/Utilities/TemplateIcon.icns
 port selected ====
embedXcode_check
ERROR
Xcode project not found
PRODUCT_NAME
XCODE_VERSION_ACTUAL
Xcode
 required,
 installed
BOARD_TAG
http://embedxcode.free.fr
/Utilities/embedXcode_prepare
message
/release.php?tag=
&goal=
&ver=
embedXcode+
release
Installed release is
.php
DOCTYPE html PUBLIC
==== New release
 available ====
A new release of embedXcode is available.
Ignore
Go to Download
http://www.embedXcode.weebly.com/download
Have you contributed? Thanks!
==== Release
 installed ====
==== Message ====
==== End of message ====
embedXcode is donationware.
Contribute
http://www.embedXcode.weebly.com/contact
zPLR
3  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Telnet Server on: September 13, 2013, 10:57:10 am
Thankyou!
4  Using Arduino / Programming Questions / Re: Code to read differential ADC values on Tiny84 on: July 11, 2013, 06:08:51 pm
Yeah I had a feeling something weird was going on, if I reverse the battery I get zero.

Doing   ADCSRB |= (1<<BIN); doesn't work as BIN has been redefined somewhere in the Arduino headers, but   ADCSRB |= (1<<7); works and results in an read value of 670 floating, 600 when the battery is reversed and about 740 when it's the right way around.

Edit: I discovered the problem, I had left a wire attached between the differential negative  and ground... Oops. Since removing that both the bipolar and unipolar work perfectly. Thankyou very much for you help, I hope Google crawls this for the benefit of others!
5  Using Arduino / Programming Questions / Re: Code to read differential ADC values on Tiny84 on: July 11, 2013, 05:19:05 pm
The reason is that ADEN is defined as the bit number, i.e. 7. If you do 1 shifted up 7 places you get 0b10000000 which is I think what you were expecting.
That makes much more sense. Thanks!

Quote
Perhaps the battery is quite discharged? Or you power supply is not 5V, but something a bit less?

Thanks for pointing out the formula, I skimmed over that but wasn't quite sure on the difference between unipolar and bipolar. I have since Googled it and now know! The battery is 1.16v and the Vcc is 5.01v, so maybe its just an inaccurate ADC?
6  Using Arduino / Programming Questions / Re: Code to read differential ADC values on Tiny84 on: July 11, 2013, 03:34:21 pm
Thankyou both for your replies, I had a feeling someone would say "You first" smiley-razz I did have a good poke around, but due to not really understanding the MUX[5:0] bit, which I now do slightly more (thanks for pointing out that table Tom C, I missed it before), I didn't know where to start. I tried printing the contents of the ADMUX register to see what was in it, but it was just zero. Probably because I hadn't set it to do anything yet... smiley-grin

Here's my code now, which seems to output something useful! Attaching a 1.2v battery gives a reading of ~95. I'm not sure how that relates to the actual voltage though, as 5/1000 is 0.005mv per step, and I get 95 which is 95*0.005=0.475?

Code:

void setup() {               
  Serial.begin(9600);
}

void loop() {
  int tmp=0;
  ADMUX = (0b00 << REFS0) | (0b101000 << MUX0); //select VCC as reference and PA0/PA1 as the differential channel

  ADCSRA |= 1100000;
  delay(10);


  tmp=ADCL;
  tmp|=(ADCH << 8);

  Serial.println(tmp);

}

I did attempt using the defines instead of  ADCSRA |= 1100000; but it didn't seem to work. I tried:
Code:
ADCSRA |= ADEN;

ADCSRA |= ADSC;

I then printed the values of ADSC and ADEN, and they were 110 and 111. Completely different to the binary I read from the datasheet.
7  Using Arduino / Programming Questions / Code to read differential ADC values on Tiny84 on: July 11, 2013, 01:31:55 pm
Hi,
I've searched high and low for examples on how to set the registers correctly then read the values for differential ADC. Unfortunately differential ADC seems to be rarely used, the only examples I've found are for the Mega. I'm not too good at deciphering the Atmel datasheets, but on page 133 of the datasheet it explains which registers to set and how to read them. If anyone could give an example of how to actually set the registers appropriately, that'd be great.

Thankyou!
-Eli
8  Using Arduino / Sensors / Re: Differential Sensing with Arduino on: July 11, 2013, 12:31:06 pm
Seems not to work on the ATTiny84..?
9  Using Arduino / Motors, Mechanics, and Power / Re: Isolating grounds with voltage divider and current shunt on: July 09, 2013, 08:20:08 pm
Thanks for your reply, apologies for the massive block of text last post, i had to tap it up quickly before boarding a plane...!

I had considered RS485 (mistakenly wrote RS422 in the OP) but the problem with using a protocol other than I2C is this module is part of a larger system, namely a remote controlled robot. The alternator runs from an engine to keep the batteries topped up, and I'd like it to be able to tell the main CPU the current/rpm/load via I2C.

I discovered something interesting about the '84, its got differential ADC which I think I could use for the voltage and current, as presumably the inputs are isolated from signal ground (indeed from any low impedance silicon inside the chip); and being relative to each other, noise wouldn't be an issue. I could then optoisolate solely the MOSFET and the '84 could run from the switch mode PSU. Do you think that might work?

Thanks again
10  Using Arduino / Motors, Mechanics, and Power / Isolating grounds with voltage divider and current shunt on: July 08, 2013, 08:42:28 pm
Hi,
I have designed an alternator regulator which uses an ATtiny84 and includes I2C to talk to an Arduino. The 5v power and the ground for the ATtiny85 is supplied from the same rails the main Arduino (a Mega) uses. This is powered from a switchmode power supply and filtered to provide very clean power. The problem I have is how to isolate the noisy alternator ground from the ATtiny but still allow such things as the voltage divider, chopper MOSFET and shunt resistors to work. For the MOSFET I could use an optoisolator, but due to their nonlinearity I am unable to use one for the analog shunt nor voltage divider. I also can't use it for I2C due to it needing to be bidirectional. I don't want to connect the alternator and switchmode PSU grounds due to that creating a ground loop. Would adding two RS422 differential chips (one attached with the ATtiny to the noisy alternator supply/ground, and one to the clean switchmode power supply/ground) do the trick?

Probably quite an unusual question but if anyone has any help I'd appreciate it.

Thanks!

Schematic is below...
11  Using Arduino / Networking, Protocols, and Devices / Re: Is my Mega broken...? on: July 31, 2012, 08:36:28 am
Just for completeness, I've got a new Arduino Mega and the I2C scanner works fine on it with nothing connected. When the pullup resistor is enabled on pin 20, it actually goes to 5v too, most useful... smiley-razz
Seems the other board's SDA pin is definitely broken.
12  Using Arduino / Microcontrollers / Re: Bootloader for Tiny chips? on: July 30, 2012, 08:13:00 pm
Apologies, I somehow missed that part of your post...! I'm impressed with how small you got the bootloader though.

Perhaps you could (at the expense of board size) use resistors and zeners to clamp the off-chip voltage to 5v, which due to the resistors, would allow a HV programmer to program the chip at HV still? Or if you only need to change the program very occasionally, perhaps you could simply use solder bridges? Of course either way you'd need a HV programmer, but just an idea anyway smiley
13  Using Arduino / Microcontrollers / Re: attiny 85 ping sensor on: July 30, 2012, 07:40:33 pm
i think they are picking up on eachother because  there is alot of random activity if i use only 2 it works fine but i only get 2 of the 3 colors at that point ....

If they're ultrasonic ping sensors, you need to wait 70ms or so for the previous ping to fade away before firing out another ping.
14  Using Arduino / Microcontrollers / Re: Bootloader for Tiny chips? on: July 30, 2012, 07:31:29 pm
What's the reason for needing a boot loader? It uses a fairly large amount of space on a chip with so little flash space!
15  Using Arduino / Networking, Protocols, and Devices / Re: Is my Mega broken...? on: July 27, 2012, 02:34:22 pm

You leave the I2C pins floating and expect a result from the scanner? What exactly do you expect as the output?

I2C needs pullup resistors to get a correct result.

Quote
When setting pin 20 to input and writing high to it however, it stays low. Any ideas?

Show us the code you use for that and the exact wiring you used (draw a circuit diagram).

The pins aren't floating. Wire.begin() enables the internal pull up resistors, and with nothing attached the scanner should still work but be unable to find anything. Like I said, with nothing attached to the Duemilanove it works, the same code with nothing attached to the Mega hangs.

The code for the second part is as follows. Rather simple. There is no wiring at all for the code below.
Code:
void setup(){
pinMode(20,INPUT);
pinMode(21,INPUT);
digitalWrite(20,HIGH);
digitalWrite(21,HIGH);
}

void loop(){
}

Normally the mega is hooked up to a PCB with two 4.7k pull up resistors, and a SRF02. It works fine with the Duemilanove, but not the Mega using the same wiring.

What's weird is that pin 20 stays low when the internal pullup is on, but when it's set to an output and set high, it does go high. Almost as if the internal pullup is burnt out somehow.
Pages: [1] 2 3 4