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.

Rod Lopez's Content

There have been 33 items by Rod Lopez (Search limited from 05-May 23)


By content type

See this member's


Sort by                Order  

#12079 String.format

Posted by Rod Lopez on 13 April 2011 - 01:35 PM in General Discussion

In case anybody else has similar issues the solution is as simple as this:

Write("V " + V.ToString("F1") + " A:" + A.ToString("F2") + " W:" + (A * V).ToString("F1"));

...the funny thing is that ToString sometimes seems to return the value and sometimes the name of the type, that's why I didn't try it before. :)



#12078 String.format

Posted by Rod Lopez on 13 April 2011 - 12:26 PM in General Discussion

Hi there,
I am having a very simple issue, I am trying to write a few values to a 16x2 LCD, the values are, originally floats. I need to be able to see the whole set of info in a single glance.

The issue is that, by default, I end up printing too much (the number plus eight digits of precision), so my result doesn't fit on the screen at all.

My code looks like this:
	float A = 0, V = 0;
	PowerSampling.GetPower(ref V, ref A);
	Write("V " +  V + " A:" + A + " W:" + A * V);

...and the code I am trying to replicate (I am porting this from an Arduino) looks like this:
	float A, V;
	PowerSampling.GetPower(V, A);
	lcd << "V" << _FLOAT(V, 1) << " A" << _FLOAT(A,2) << " W" << _FLOAT(V * A,1);

I was intending to use String.Format but that doesn't seem to be supported... how can it be done?



#12017 Problem with GliterFilterTime

Posted by Rod Lopez on 12 April 2011 - 02:14 PM in General Discussion

Hi guys, It seems to me like it would be great to be able to choose the de-bouncing algorithm. Charles makes a good point (and a great post) on how to do debouncing, but it does add to the complexity and cost of a prototype board. ...plus you may not not have the right ICs at hand. I would love to be able to throw cycles to the problem (at the cost of memory and perf) rather than having to change the board layout/part list if that'd be possible. For a final product it might not matter all that much, but in the prototyping stages it is handy to just have these things working out-of-the-box :)



#12077 Problem with GliterFilterTime

Posted by Rod Lopez on 13 April 2011 - 12:19 PM in General Discussion

I ended up writing something like this:

	static DateTime lastTrackerSwitch = new DateTime();
	static void OnTrackerSwitchButton(uint data1, uint data2, DateTime time)
	{
		if (time.Ticks - lastTrackerSwitch.Ticks < 150 * System.TimeSpan.TicksPerMillisecond)
			return;
		else
			lastTrackerSwitch = time;

		//Here goes your code, being called after debouncing
does that seem sane?



#13084 Power through vIn pin?

Posted by Rod Lopez on 10 May 2011 - 01:14 PM in Netduino Plus 2 (and Netduino Plus 1)

so I thought, my EE skills are a tad rusty, so didn't want to risk it :) Thanks!



#13053 Power through vIn pin?

Posted by Rod Lopez on 10 May 2011 - 08:59 AM in Netduino Plus 2 (and Netduino Plus 1)

I mean the Vin, I would hope not to toast the pin or its connections, right now I am peaking at around 150mA when all servo and display hell breaks loose :) So what I would like to know is if 300mA would be okay to take through the Vin.



#13049 Power through vIn pin?

Posted by Rod Lopez on 10 May 2011 - 08:34 AM in Netduino Plus 2 (and Netduino Plus 1)

Can I power the Netduino using unregulated 7.5-12 volts though the vIn pin in the board? as in... instead of using the power connector If so.. what's the maximum power I can drain? (I have a few 3.3 and 5v devices connected to the Netduino)



#13079 Power through vIn pin?

Posted by Rod Lopez on 10 May 2011 - 01:03 PM in Netduino Plus 2 (and Netduino Plus 1)

I'll use Vin as input then, there's one tiny detail left though... the switching between Vin and USB for power, is it mechanical or electronic?



#11965 Out of memory issues

Posted by Rod Lopez on 11 April 2011 - 08:24 PM in General Discussion

It seems like it was as Mario suspected, if all the incoming data is not consumed with a read() call it'll just accumulate and start consuming RAM, until it runs out. I connected a callback to RXOver but never got called, I'll get back if I can get the experiment in the right setup again (you know how it when you need to break some things in order to fix others :)



#11455 Out of memory issues

Posted by Rod Lopez on 30 March 2011 - 06:24 AM in General Discussion

What happens if you move the buffer array up to the class level rather than creating a new instance each time the event fires?

I get more or less the same result, it might take a bit longer (it is hard to say) but still runs out of memory at aprox the same pace.

The only issue you might have is about the serial incoming data rating. 9600 bps aren't an high speed, but if the incoming bytes are many more than the 10-byte buffer, probably the code is not able to empty the internal buffer.


I am pretty sure I am getting much more data than what I am consuming -through serialport.read-. I assumed it would be stored in the serial chip's memory and when full it would just drop new data. I'd make sense that, if an internal buffer expands with arriving data it would end up too big... I'll give that a shot and report back



#11443 Out of memory issues

Posted by Rod Lopez on 29 March 2011 - 11:32 PM in General Discussion

Hi there,
This is my first post here, so please let me know if I am posting in the wrong place :)

So, as to the issue...
I have a setup where I am using one of the Netduino COMs as serial interface to an external chip (an IMU), communication works, and everything is fine and dandy (a.k.a I get my data through the serial), but I eventually (pretty much at predictable intervals) get an 'Out of Memory' error.
I honestly thought that moving to a managed framework meant that you didn't have to care about your memory anymore, is that true? do I need to release / dispatch memory blocks somehow? Do I need to manually invoke the garbage collector?
Could you give a look to the code and tell me if I am doing something terribly wrong?

thanks!!
-rod

IMUSerial = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
IMUSerial.DataReceived += new SerialDataReceivedEventHandler(IMUSerial_DataReceived);
IMUSerial.Open();

//write IMU code
Debug.Print("Serial is " + (IMUSerial.IsOpen? "open" : "not opened"));
byte[] pip = System.Text.Encoding.UTF8.GetBytes("r");

Debug.GC(true);
while (true)
{
	IMUSerial.Write(pip, 0, 1);
	Thread.Sleep(100);
	
}

static void IMUSerial_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
	byte[] buffer = new byte[10];
	IMUSerial.Read(buffer, 0, 10);
	String message = new String(System.Text.Encoding.UTF8.GetChars(buffer));
	Debug.Print(message);
}



#12137 LCD KS0066 driver?

Posted by Rod Lopez on 15 April 2011 - 09:35 PM in General Discussion

Hey Ken, You might want to check this one out: http://icontexto.com/charactercreator/ I saw it recommended by Ladyada some time ago...



#11627 Interrupt/Event Problem

Posted by Rod Lopez on 04 April 2011 - 09:50 AM in Netduino 2 (and Netduino 1)

Are there any news regarding this issue? I have the same SerialDataReceivedEventHandler-not-triggered issue with an extra bit of info, my event gets triggered if I am debugging from the PC, if the netduino runs standalone (as in non-f5, just a local reset) then I never get the events. I have changed the code to constantly look for serial data in the main loop and then it works, ideas? suggestions? popcorn?



#12039 Interrupt/Event Problem

Posted by Rod Lopez on 12 April 2011 - 09:34 PM in Netduino 2 (and Netduino 1)

Hi Chris, Nope, I haven't updated the firmware (I am trying to keep my schedule for releasing something and I am afraid of the "beta" moniker) What I have done is check out the changes and follow the description of the fix to one of the bugs (surely the same you think) to figure out and avoid the bug at setup-time, and it does work as expected. I am pretty confident the firmware upgrade will make my fix redundant :)



#12136 Inter pin resistance

Posted by Rod Lopez on 15 April 2011 - 09:29 PM in General Discussion

@Mario: It has been a really strange trip that one. I have finally managed to get things running, but I'll look for a trivial case that can reproduce the error I've been having (maybe it is some combination of software and hardware) My basic assumption is that, under normal circumstances, connecting an analog pin to a circuit where another analog pin is connected shouldn't change the value returned by the first pin. That assumption was broken in my Netduino circuit (where as I was having perfectly valid reading on an Arduino version). One of the main issues, I think, is that the analog sampling happens in a given moment in time, and I have a couple of switching circuits that could be producing parasitic frequencies, with a bit of luck I ended up sampling a few of those peaks. Your answer made me rethink the whole approach and eventually to figure out what was going on :) I will, though, try to document the issue if I can get a good repro case, I am sure the guys at Secret Labs would be interested.



#13224 Inter pin resistance

Posted by Rod Lopez on 13 May 2011 - 10:34 AM in General Discussion

Hi guys, Chris: That was my assumption too, it is good to know. An overload is definitely possible (though I encountered the issue from early on proting from an Arduino setup) I am dealing with both robotics and power sampling so it seems reasonable a cable would have touched something it shoudln't. One question on the "damage", what are the chances the issue might be consistent (as in, would I be able to add a multiplier to the incoming signal and sure, loose precision, but use the pin ) or can it become totally random? Mario: The ref is plugged to 3.3. Seems a bit funky to have to connect physically though, is there any way to wire those internally? Software maybe? I might be answering the wrong thing though, I don't quite get what you mean by "+3.3V >= VRef >= Vin" if I read that a-la software it doesn't quite make sense to me :)



#13380 Inter pin resistance

Posted by Rod Lopez on 17 May 2011 - 02:51 PM in General Discussion


3.3v has to be greater or equal than VRef, which should be greater or equal than Vin, the signs should be the other way around, or am I a bit confused?

Exactly what I mean and what the specs wants.
Why are you confused?


The reason why I am confused is that it sound like Vin is to be 3.3 volts or lower, which isn't enough to feed the Netduino in any case. That's what +3.3V >= VRef >= Vin tells me, anyway.

Btw, I did measure the resistances of all the pins, across ground and different pins, the input resistance returned by the multimeter is very high (non-measurable really). My guess is that some magic inside the AD has gone off, possibly not blown (I can measure in a fairly deterministic way) but definitely not in the right range.

There's one thing that puzzles me, though. It feels like the Netduino reports a lower voltage than it should. It is normally a bit lower (in any pin) than the voltage reported by either power source or multimeter, but, as the load increases (let's say the LCD screen that's fed by the Netduino goes on), the voltage reported by the Netduino decreases much faster than what's reported by the multimeter.
We are not talking about massive value offsets, mostly in the order of one-two tenths of a volt; but I am keeping track of battery charge and it gets sensitive to small voltage changes :)



#13216 Inter pin resistance

Posted by Rod Lopez on 13 May 2011 - 09:27 AM in General Discussion

Finally I have had a bit of time to create a repro case.

What I have set up is very simple, an external power supply with a voltage divider (22k/10k), ground to Netduino ground and the divider being fed to an analog analog pin.
What I get is super funky:
-using any analog input but for a3 things seem to work all the time the way you'd expect.
-Reading from analog3 does actually (pretty much exactly) half the sampled value, but not only from the Netduino side (as in not a software-scaling problem), if you put a voltmeter to the divider, the divider's voltage does drop the moment the divider is connected to a3, otherwise the value is what you'd expect.
Is a3 special in any way? Is my board broken in the strangest manner? Qui lo sa? :)



#12085 Inter pin resistance

Posted by Rod Lopez on 13 April 2011 - 08:57 PM in General Discussion

Hi all, I am trying to debug a simple yet specially tricky situation, I am trying to measure both voltage and current going through a certain circuit. The voltage is no big deal, resistor divider: Vcc----1M---+A0---470k---GND ..and I measure across A0 and GND, all good. The problem is the current, I add an extra resistance, so things look a bit like Vcc----1M----+A0---470k--10---+A1----GND At that point, though I get a decent reading for current, my reading for voltage goes to hell... My guess is that the internal resistance between A0 and A1 is lower than I expected (acording to the change in result it should be around 500k), so that one would appear in parallel with the 470k resistance and kill my reading. I can throw an opAmp (or lower the divider's resistors)and be over with it fairly quickly, but I would like to make sure I understand what's going on. Does anybody know what the internal inter-pin resistance should be? thanks!



#13235 Inter pin resistance

Posted by Rod Lopez on 13 May 2011 - 02:56 PM in General Discussion

Hi again! @Chris: The measured/real ratio seems to be fairly stable at 0.43 no matter how low or high the incoming sampled value is, can I take that as I-can-use-the-pin? Btw, I do have a similar but lower-scale issue with analog reading in other pins (ratio being around 6%) even in pins I have never used, is that within acceptable Netduino precision?. The offset also seems to change when the power drain through the Netduino (Vin->5V output) increases (about .8%) when drain increases from 5mA to 80mA. @Mario: I still don't get it, the way I read +3.3V >= VRef >= Vin is: 3.3v has to be greater or equal than VRef, which should be greater or equal than Vin, the signs should be the other way around, or am I a bit confused? The idea of checking the power drain was great, through a3 I get 0.2 mA, in other pins it is too low to measure (I am using about 1.3v) @Mark: Thanks for the tip, I have noticed that vRef connected-and-non-connected where giving me the same values and I was wondering if it was a coincidence or something. What you mention would make ton of sense. Btw, how do I know if I have a rev a or b board?



#12172 How can I get amperage input?

Posted by Rod Lopez on 17 April 2011 - 10:56 AM in Netduino 2 (and Netduino 1)

Hi Sam,
One way you can do it is by adding a very low resistor (a shunt resistor as they are usually called) between the ground and the servo's ground. An increase in current will increase the voltage dropped across the resistor.
I have been using a 0.1Ohm and an op amp (just to make the voltage easier to read from the Netduino) and it's been working like a champ.

Just for reference you can check Shunt resistors, look for "Use in current measuring"



#21629 Current State of features

Posted by Rod Lopez on 12 December 2011 - 08:44 PM in General Discussion

Does anybody have any thoughts on my idea of using UART-to-USB in pins 2&3 and leaving 0&1 as input/output? or using 0&1 with an off-Netduino UART-to-USB chip?



#21616 Current State of features

Posted by Rod Lopez on 12 December 2011 - 01:28 PM in General Discussion

Mario, I am not planning to run the device from a 9 volt battery, the battery for my usage is more of large marine type, with a connected solar charger and other loads, that's where the 20mAmp come from :) Regarding the UI, the device does have a few things attached to it, including a LCD and keypad, the way it is setup right now I raise an event on key pressed and that wakes up the display lighting and a couple of other things. The issue is that, if switching off the whole board, the Netduino wouldn't be able to wake up on time for the UI to flow nicely.



#21625 Current State of features

Posted by Rod Lopez on 12 December 2011 - 08:41 PM in General Discussion

Have you measured the total time for your application to start from a cold boot? I am curious as I would have thought that it would be possible to get that into an "acceptable" range.

As for handling the keyboard and display, why not use a really low power chip (like perhaps the $4.30 TI MSP430 board) to handle that and cause the Netduino to boot as required (like when a key is pressed).


Jonny,
Nope, I haven't really measure it, but the response should be fast enough to feel fluid, probably less than 30ms from button to UI response, that's, I think' way out of any MCU league (other than hardware-interrupt wake up). That aside there are also menu entries displayed that would need updating every second, seems to me like quite a bit of the time for sleep would be spent waking up in such a scenario.

I have thought about having an extra MCU (msp430, atmega328) dealing with the menu/UI side of things, the problem is that it gets more complex both software and PCB-wise, and more expensive to manufacture.
The menu display does require some access to much of the rest of the code. In that sense, for the rest of what the code is doing right now the extra added complexity wouldn't make sense, it would just make sense to simply put the whole code in the msp/328 instead.



#21662 Current State of features

Posted by Rod Lopez on 13 December 2011 - 03:54 PM in General Discussion

Not sure what's the problem. If you're thinking to a FTDI chip, wired as the Boarduino does, I guess there's no problem.
However, that will be an USB slave, not master.
Cheers


Precisely, I was thinking on using digital 0-1 (or 2-3) as RxTx for a FTDI chip. So what you mean is that it is possible, as long as I don't use the native Netduino USB part. Am I right?

Does your last comment mean that the Netduino's USB can act as USB master? Can I theoretically talk to a slave device such as an iPhone or an Android tablet?




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.