Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

teo's Content

There have been 12 items by teo (Search limited from 29-March 23)


By content type

See this member's

Sort by                Order  

#41283 Nokia 3110/LCD4884 JoyStick

Posted by teo on 09 December 2012 - 09:52 PM in Netduino Plus 2 (and Netduino Plus 1)

The joystick output is an analog output that ranges from 0 to 5V, depending on direction (the Vcc for the resistor ladder is tied to 5V). If you compute the analog values for SW1 positions 1,2,3,4,6, the outputs will be 0.000 0.235 0.720 1.434 3.573 volts, respectively, or 0 73 223 445 1109 bits > maxed out, try 1023 Hence, there is a chance that you will slightly exceed the 3.3V limit of the Netduino ADC. You might be able to get away with it, but this is not recommended. Also, note that the joystick feeds AD0 with 5V when nothing is pushed. If I am not wrong, the digital pins are 5V tolerant, but not so for the analog pins.



#27793 Multiple I2C devices

Posted by teo on 21 April 2012 - 07:48 AM in Netduino 2 (and Netduino 1)

I see! Yep, that worked perfect! :lol: Thanks alot!



#27788 Multiple I2C devices

Posted by teo on 21 April 2012 - 05:56 AM in Netduino 2 (and Netduino 1)

I have updated my firmware and now there are no errors!

However, the readings I got back are not quite expected. Can you please check the implemention, especially this line:
device.ReadInternalAddressBytes(i2cconf2, rbuf, 27, 8);
I am trying to read 8 registers from one of the devices, starting from register number 27 (or 0x1B). Is this the right way to do it?



#27694 Multiple I2C devices

Posted by teo on 20 April 2012 - 07:02 AM in Netduino 2 (and Netduino 1)

Well, I don't really know how to tell the firmware version. I have never flashed any of them in since I purchased the board. Can you tell me which firmware version works? And I'll go get that version.



#27600 Multiple I2C devices

Posted by teo on 18 April 2012 - 11:13 PM in Netduino 2 (and Netduino 1)

Guido,

I tried to use your driver and I can't seem to get it to work. An exception pops up. Odds are, I have used your code the wrong way.

    #### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (1) ####
    #### Message: 
    #### Netduino.Extender.TransferAdapters.I2CAdapter::ModifyToRepeatedStartTransaction [IP: 0013] ####
    #### Netduino.Extender.TransferAdapters.I2CAdapter::CreateInternalAddressReadTransaction [IP: 0013] ####
    #### Netduino.Extender.TransferAdapters.I2CAdapter::ReadInternalAddressBytes [IP: 000a] ####
    #### NetduinoPlusApplication1.Program::Main [IP: 003a] ####

Can you please see the following code? I have 3 I2C devices on the bus, and I am just trying to read one of them (device_addr = 104) in an infinite loop. The internal registers to read from is 27 to 34 (8 registers to read).

        public static void Main()
        {
            I2CAdapter device = I2CAdapter.Instance;

            I2CDevice.Configuration i2cconf1 = new I2CDevice.Configuration(83, 400);//accl
            I2CDevice.Configuration i2cconf2 = new I2CDevice.Configuration(104, 400);//gyro
            I2CDevice.Configuration i2cconf3 = new I2CDevice.Configuration(30, 400);//mag

            byte[] rbuf = new byte[8];

            while (true)
            {
                device.ReadInternalAddressBytes(i2cconf2, rbuf, 27, 8);
                Debug.Print("");//print results to debug window here
                Thread.Sleep(500);
            }
        }

Thanks for taking the time!



#27565 Grove - 3-axis Gyro I2C problem

Posted by teo on 18 April 2012 - 05:15 PM in Netduino 2 (and Netduino 1)

Looking t the datasheet there is no mention of the module supplying it's own pull up resistors. It is also not clear from the photograph how the module is connected to the Netduino. So I'd consider investigating this.

regards,
Mark


According to the schematic of the module, there are 10k pullups on the bus, before and after the 3v3/5v level-shifter.



#27512 Grove - 3-axis Gyro I2C problem

Posted by teo on 18 April 2012 - 01:29 AM in Netduino 2 (and Netduino 1)

Another thing, I realised that you enabled interrupts:
gyro.WriteToRegister(0x17, 0x01);
Looking at the photograph, the interrupt line is not connected to the netduino. (I don't think that's the source of your problem, though.)



#27483 Grove - 3-axis Gyro I2C problem

Posted by teo on 17 April 2012 - 08:21 PM in Netduino 2 (and Netduino 1)

Perhaps the connectors are not firm enough and shaking the device might (for a split second) disconnect the I2C bus and result in an unrecoverable error state. Not sure if this is your case, but it happened to me last time.



#27123 Multiple I2C devices

Posted by teo on 13 April 2012 - 12:47 AM in Netduino 2 (and Netduino 1)

Guido, Thanks for the (in my view, very complicated) code! :D I'll try it out real soon. Meanwhile, I am trying to understand it... I am not very experienced in C# and some parts of the code like "sealed class" and "lock" doesn't ring a bell! I'll read more and find out.



#27083 Multiple I2C devices

Posted by teo on 12 April 2012 - 05:16 PM in Netduino 2 (and Netduino 1)

I have a question on the how to read/write data from more than 1 I2C sensors. The problem I faced was: Every time I need to read a sensor, I have to create the I2CDevice and then dispose it after I finish with the read/write transaction. Otherwise, I cannot read from the other I2C devices (cannot create more than 1 I2CDevice at any given time).

I2CDevice.Configuration Myconfig = new I2CDevice.Configuration(addr, clkrate);  
I2CDevice MyI2Cdevice= new I2CDevice(Myconfig);                                
// create the transaction and execute here                                     
MyI2Cdevice.Dispose();                                                         

This create-dispose way seems to be rather inefficient, as I need to poll the sensors sequentially. I have no problem with getting all my readings if I do it this way, but is this the best way to write the code?



#22048 LCD4884 DFRobot shield SPI interface

Posted by teo on 24 December 2011 - 03:52 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi,

I have found a solution for the problem (not perfect, but works).

There is a column of pads on the bottom-left corner of the LCD. Connect "SCLK" to Pin13 and "SDIN" to Pin11. Optionally, you can connect digital pin 10 to "BL_ON". These pins are easily accessible from the built-in rc servo connectors.

Then, use the driver found here:
http://wiki.netduino...hx?NoRedirect=1
(I didn't try the 3310 driver you mentioned)

Next, make these two changes:

// From "Program.cs":
Nokia_5110 Lcd = new Nokia_5110(true, Pins.GPIO_PIN_D10, Pins.GPIO_PIN_D9, Pins.GPIO_PIN_D7, Pins.GPIO_PIN_D8);
// Change to:
Nokia_5110 Lcd = new Nokia_5110(false, Pins.GPIO_PIN_D5, Pins.GPIO_PIN_D7, Pins.GPIO_PIN_D6, Pins.GPIO_PIN_D4);
// If pin 10 is connected to "BL_ON", then change to:
Nokia_5110 Lcd = new Nokia_5110(true, Pins.GPIO_PIN_D5, Pins.GPIO_PIN_D10, Pins.GPIO_PIN_D6, Pins.GPIO_PIN_D4);
Why: To match the DFR lcd pin out.


// From initialisation line of "Nokia.cs":
spi.Write(new byte[] { 0x21, 0xBF, 0x04, 0x14, 0x0C, 0x20, 0x0C });
// Change to:
spi.Write(new byte[] { 0x21, 0xc0, 0x06, 0x13, 0x20, 0x0c });
Why: Frankly, I do not know *why* .. I just followed the initialisation procedure from the original Arduino driver (LCD4884.cpp). If you are curious, you may want to check the datasheet of the LCD driver. If you skip this change, the contrast of the display will be very poor.


Some notes:
-(updated)If you find that there are some artefacts on the screen, you may need to reduce the SPI clock from 4000kHz to 1000kHz. I found that 1000kHz worked better for me.
-The "useBacklight" parameter must be set to "false" as the DFR LCD's backlight pin is digital pin 7 (not a PWM pin). You can still switch it on and off, but you cannot dim it by the PWM hardware. However, I have connected digital pin 10 to the "BL_ON" pad of the LCD so that I can still use the PWM functionality.
-The drawback of this method is that digital pins 2,3 (the former CLK and MOSI lines) are no longer usable as GPIO pins since they are now electrically connected to pins 13,11, respectively. You will further waste digital pin 7 (the former backlight pin) if you have connected digital pin 10 to "BL_ON".



#22046 LCD4884 DFRobot shield SPI interface

Posted by teo on 24 December 2011 - 12:55 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi, I am switching to netduino now and I have the same problem with that shield. The SPI pins of that shield (pins 2,3) are not the same as the ones arduino/netduino have. In the netduino, the hardware SPI pins are at digital pins 11,12,13. If you own a netduino plus, the second SPI port is taken up by the SD card. In my humble opinion, one way to fix this is to bit-bang pins 2, 3 and the other control pins for the lcd to achieve some "software SPI". But that may be a headache since if the lcd still doesn't work, you don't really know whether the software SPI is implemented wrongly or the lcd configuration is wrong (not sure if that DFR lcd = nokia3310). Got to do it carefully. For a start, I'm going to look out for some good software SPI codes out there.




home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.