Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Tiger.Bomb
Jan 22, 2012
From doing that micro corruption stuff I kind of fell in love with msp430's instruction set.

Adbot
ADBOT LOVES YOU

reading
Jul 27, 2013
Has anyone used one of these Neural Network chips or found a use for them? They sound pretty interesting but I have only an extremely superficial exposure to neural networks:

http://www.cognimem.com/products/chips-and-modules/CM1K-Chip/index.html

sales pitch posted:

The CogniMem™ CM1K Chip is the first ASIC version of the CogniMem neural network product line optimized for Cognitive Computing. It features 1024 neurons working in parallel implementing two reknown non-linear classifiers. It can recognize patterns at high speed while coping with ill-defined data, unknown events and changes of contexts and working conditions. Furthermore, CogniMem CM1K Chips can be daisy-chained to other CogniMem CM1K Chips to increase the network size. Its low pin-count and low power consumption make it an ideal companion chip for smart sensors and cameras. Its parallel architecture make it an ideal candidate for large data mining systems.

I'm not clear on how it "learns" versus how it has to be taught/trained first.

Tiger.Bomb
Jan 22, 2012
yeah that sounds like a way to make the storyline from terminator happen.

Twink Toilet
May 15, 2004
:D

Tiger.Bomb posted:

yeah that sounds like a way to make the storyline from terminator happen.

You say that like it's a bad thing.

blorpy
Jan 5, 2005

I've tried searching around a bit, but I haven't found any good sources - do you folks know where I can read up on low power implementations for embedded? I have an idea for some things I think might be applicable techniques (CPU sleep states, multiple clock sources) but I keep seeing this as a particular bullet point on embedded job listings and would love to learn more about this topic.

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS
I'm sure TI has volumes of app notes about it for their Launchpad, it's kinda their thing. Come to think of it, you'll probably find some good ones from Microchip or Atmel, too. Like this: http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en556618

Delta-Wye
Sep 29, 2005
The MSP430 is engineered from the ground up for that target market. IMHO it makes them a bit of a pain in the rear end to use; there are tons of clock domain stuff to fiddle with, and every peripheral has more options and configuration steps compared to PIC or Atmel's offerings in order to shave off a bit of power usage here and there. TI has a few app notes that may be of interest though. I like this one, it's simple and somewhat counter intuitive if you haven't studied static vs. dynamic losses in logic gates.

https://www.ti.com/litv/pdf/slyt356

qsvui
Aug 23, 2003
some crazy thing
Does anyone know of any good Wifi modules? I'm fairly new to embedded Wifi (or Wifi in general) so if anyone could share their experiences, it would be much appreciated. I'm leaning towards one of these right now:

http://www.murata-ws.com/products/wi-fi_network_controller.php

At this point, I just need it to connect to the internet and be controlled by UART/SPI. Embedded networking stack is optional.

Harik
Sep 9, 2001

From the hard streets of Moscow
First dog to touch the stars


Plaster Town Cop

Delta-Wye posted:

The MSP430 is engineered from the ground up for that target market. IMHO it makes them a bit of a pain in the rear end to use; there are tons of clock domain stuff to fiddle with, and every peripheral has more options and configuration steps compared to PIC or Atmel's offerings in order to shave off a bit of power usage here and there. TI has a few app notes that may be of interest though. I like this one, it's simple and somewhat counter intuitive if you haven't studied static vs. dynamic losses in logic gates.

https://www.ti.com/litv/pdf/slyt356

I've done low power on both the MSP430 and xmega devices, with the xmega you flip off the modules you aren't using then drop into low power sleep. I think the msp uses slightly less power but we can run indefinitely off a coin cell so not a massive advantage for TI.

OctaviusBeaver
Apr 30, 2009

Say what now?
Does anybody have any advice for getting into Bluetooth? I'm thinking books, websites or development kits. I'm starting pretty much from scratch but it seems like a hot topic these days and I am interested in learning about wireless stuff so it seems like a good place to start. Google took me here to a TI kit but I would like to hear some opinions before I drop $100 on it.

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe
My group is working on an Arduino game project using the Gameduino 2 and an Arduino board with only 2kB of memory. I work mostly on the underlying architecture and so far I've been fairly good about using precompiler macros for constants to save on SRAM. However, I'm currently working on a particle system and I'm having issues with how to carry on the practice of making sure constant values don't take up the ever so valuable SRAM and still avoiding redundancy.

I have a Particle superclass with virtual functions for update() and draw() and create subclasses for every type of particle I need. The problem arises because every particle has a life span, which is different between particle types, but constant for a single subclass of Particle, but the code for handling this lifespan is the same for all subclasses. As such, it seems I would have to either write the exact same code for every Particle subclass or have to live with using another byte per particle for their life spans. Is there any way to avoid the redundancy, while also having the life span in the program memory?

This is the relevant code:

Particle class declaration
C++ code:
class Particle {
public:
    Particle(Math::fVec2 position, int lifeSpan);
    virtual ~Particle()=0;
    
    bool dead;
    int lifeTime;
    
    const int LIFE_SPAN;
    
    void checkLifeTime();
    
    virtual void update()=0;
    virtual void draw()=0;
protected:
    Math::fVec2 position;
};
checkLifeTime()
C++ code:
void Particle::checkLifeTime() {
    lifeTime++;
    if(lifeTime > LIFE_SPAN)
        dead = true;
}
Particle constructor
C++ code:
Particle::Particle(Math::fVec2 position, int lifeSpan) :
LIFE_SPAN(lifeSpan) {
    this->position = position;
    dead = false;
    lifeTime = 0;
}
The constructor of a subclass of Particle
C++ code:
BloodParticle::BloodParticle(Math::fVec2 position) :
Particle(position, BLOOD_LIFE_SPAN),
velocity(rand() % 11 - 5,rand() % 6) {
}
NOTE: A lot of types and calls like rand() are standard C++, since I use my desktop to debug and test overall issues when one of my group mates has the board. Assume that anything that can be uint8_t is just that.

I'm not sure if the way I've done it doesn't actually automatically store the life span in the program memory, but I have no reliable way of testing it, and since it's an actual field in the class, I would assume it does go in the SRAM?

Thanks in advance.

JawnV6
Jul 4, 2004

So hot ...

Joda posted:

The problem arises because every particle has a life span, which is different between particle types, but constant for a single subclass of Particle, but the code for handling this lifespan is the same for all subclasses.
This might help: http://stackoverflow.com/questions/10915568/is-it-possible-to-declare-a-virtual-static-constant-value-in-a-c-class

Joda posted:

I'm not sure if the way I've done it doesn't actually automatically store the life span in the program memory, but I have no reliable way of testing it, and since it's an actual field in the class, I would assume it does go in the SRAM?
When in doubt, just go look at what the assembly's doing. Found this discussion on how to do that for an Arduino.

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe

I'm pretty sure I'm already doing this. My problem is more related to hardware and how I declare my variables to save on SRAM than C++ convention. (i.e. I have a superclass function that uses a constant, but the constant is different for every subclass so I can't just use a macro, which is how I've been going about using program memory so far.)

JawnV6 posted:

When in doubt, just go look at what the assembly's doing. Found this discussion on how to do that for an Arduino.

This should help a lot, thanks! This way I should be able to tell when it uses a literal and when it points to something in the program memory/SRAM.

Tiger.Bomb
Jan 22, 2012

Joda posted:

I'm pretty sure I'm already doing this. My problem is more related to hardware and how I declare my variables to save on SRAM than C++ convention. (i.e. I have a superclass function that uses a constant, but the constant is different for every subclass so I can't just use a macro, which is how I've been going about using program memory so far.)


This should help a lot, thanks! This way I should be able to tell when it uses a literal and when it points to something in the program memory/SRAM.

you can absolutely use a constant. Have you considered conditional #defines or templates?

Pan Et Circenses
Nov 2, 2009

Joda posted:

I'm pretty sure I'm already doing this. My problem is more related to hardware and how I declare my variables to save on SRAM than C++ convention. (i.e. I have a superclass function that uses a constant, but the constant is different for every subclass so I can't just use a macro, which is how I've been going about using program memory so far.)

I'm not sure I entirely/precisely understand what you're trying to do, but I'll try to give an answer that might be useful even if I'm wrong about your question. Assuming you're using a GCC toolchain, the standard way to specify where specific variables go is by using linker scripts, which can arbitrarily divide your binary into sections and specify which memory those sections go into (.bss goes into SRAM, .text goes into flash, .myspecialconstants into SRAM, etc...). Once you have a section defined to reside in SRAM, you can use __attribute__((section("mysection"))) on any variable to put it in that section (and by extension into SRAM).

Is that the sort of thing you were going for? If so I can give more pointers if needed.

yippee cahier
Mar 28, 2005

I deal with a system with mostly statically allocated memory so it's a little different than making new objects. I'm sure we all have working linker scripts, so the main thing is making sure you've declared everything properly so it goes to the right section. I use using nm on the final image or make GCC dump out a map file during linking, then take a look through that. You should find your constants sitting in the flash memory range, otherwise you need to check your code. nm sorted by size is great for tracking down inefficient static RAM use.

My Rhythmic Crotch
Jan 13, 2011

Curious if anybody has done anything with the Freescale KL26Z (or KL25Z) chips under gcc. Specifically the USB stack. These chips are already the cheapest ARM with USB that I have found, and open source USB support would make them that much better.

robostac
Sep 23, 2009

Joda posted:

Is there any way to avoid the redundancy, while also having the life span in the program memory?

While not helpful for the more generic question, in this case couldn't you just set lifeTime to LIFE_SPAN in the constructorand decrement it in the update function and mark it as dead when it reaches 0?

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal
So a lot of the stuff being talked about is still over my head in this thread, but I was wondering about which boards may be right for me for a project I want to complete. I'm totally new to this facet of programming and especially the hardware stuff, but I'm interested.

Basically I want to run a web server from a host board (which will also talk to www), and then have client boards get instructions wirelessly from the host board's web server. I will be using sensors and physical actions on the client boards, but not the host board.

Would multiple BeagleBone Blacks be a good fit for something like this? Or maybe a BeagleBone Black for the host and something else for the clients?

Also I wish I had gotten into this sooner, because it's really cool. I played with an Arduino last night and I'm hooked.

Knyteguy fucked around with this message at 17:08 on Jun 6, 2014

Arcsech
Aug 5, 2008

Knyteguy posted:

So a lot of the stuff being talked about is still over my head in this thread, but I was wondering about which boards may be right for me for a project I want to complete. I'm totally new to this facet of programming and especially the hardware stuff, but I'm interested.

Basically I want to run a web server from a host board (which will also talk to www), and then have client boards get instructions wirelessly from the host board's web server. I will be using sensors and physical actions on the client boards, but not the host board.

Would multiple BeagleBone Blacks be a good fit for something like this? Or maybe a BeagleBone Black for the host and something else for the clients?

Also I wish I had gotten into this sooner, because it's really cool. I played with an Arduino last night and I'm hooked.

How beefy do the clients need to be? A BBB is probably a good choice for the server, as you have enough resources that you effectively won't be limited for quite a while, but it's overkill for the endpoints if all you want to do is read a sensor or move a motor.

Basically, tell us more about the project and we'll be able to make better recommendations.

Also, yeah, it's addicting isn't it? Just be careful, next thing you know you're designing your own board and dealing with the clusterfuck that is microcontroller vendor toolchains.

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal

Arcsech posted:

How beefy do the clients need to be? A BBB is probably a good choice for the server, as you have enough resources that you effectively won't be limited for quite a while, but it's overkill for the endpoints if all you want to do is read a sensor or move a motor.

Basically, tell us more about the project and we'll be able to make better recommendations.

Also, yeah, it's addicting isn't it? Just be careful, next thing you know you're designing your own board and dealing with the clusterfuck that is microcontroller vendor toolchains.

That sounds awesome; I didn't realize an individual could take it as far as designing a board themselves.

Well one of the things I want to do is have one of the clients hit the web server API every 10 minutes and get some information like how dark should it get before turning on a light. It would then check a photometer to see if that condition is met and complete a circuit behind a light switch panel if so. A little bit of room to cache data would be nice as well.

I think pretty much all of the actions I would have a client board do would be similar. Call api for data, then read a scale and conditionally turn a motor, etc.

Tiger.Bomb
Jan 22, 2012

Knyteguy posted:

That sounds awesome; I didn't realize an individual could take it as far as designing a board themselves.

Well one of the things I want to do is have one of the clients hit the web server API every 10 minutes and get some information like how dark should it get before turning on a light. It would then check a photometer to see if that condition is met and complete a circuit behind a light switch panel if so. A little bit of room to cache data would be nice as well.

I think pretty much all of the actions I would have a client board do would be similar. Call api for data, then read a scale and conditionally turn a motor, etc.

BBB is overkill for the clients then. The most expensive part of that will probably be the wifi for each client. This can be done with arduino + wifi shield, rasppi, or you can do something like use RF and have the 'server' instead broadcast every ten minutes.

My Rhythmic Crotch
Jan 13, 2011

You could do something like BBB + RFM12B for the server. Linux RFM12B driver here

Then the clients could be Arduino + RFM12B. I'm sure there are Arduino libraries.

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal

Tiger.Bomb posted:

BBB is overkill for the clients then. The most expensive part of that will probably be the wifi for each client. This can be done with arduino + wifi shield, rasppi, or you can do something like use RF and have the 'server' instead broadcast every ten minutes.

My Rhythmic Crotch posted:

You could do something like BBB + RFM12B for the server. Linux RFM12B driver here

Then the clients could be Arduino + RFM12B. I'm sure there are Arduino libraries.

This is a cool idea. I was just thinking I wanted to play with RF, too. Thanks for the help.

Also on a side note I just got the BeagleBoard plugged in and I'm about to flash it to Debian :woop:. I noticed that the RF library above needs Ubuntu so I'll have to try that later too.

My Rhythmic Crotch
Jan 13, 2011

Ubuntu is derived from Debian so you're probably good to go with either

Hadlock
Nov 9, 2004

The official Debian image is fantastic, it is lightyears ahead of the dumpy Angstrom distro that comes on it. Way more stable, you can actually plug in more than one USB device at a time without crashing the USB driver, etc etc. BBB + Debian = microcontroler heaven

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal

Hadlock posted:

The official Debian image is fantastic, it is lightyears ahead of the dumpy Angstrom distro that comes on it. Way more stable, you can actually plug in more than one USB device at a time without crashing the USB driver, etc etc. BBB + Debian = microcontroler heaven

You're terrible. I ended up reflashing back to Angstrom because I couldn't get an LED to blink as a test after installing Debian, so I went back to Angstrom. It turns out it was a bad jumper wire. Now I have to reflash back to Debian after reading this. :suicide:

So I finally decided my first project is going to be an automatic dog feeder. I'm going to have the BBB communicate with a (probably) .NET MVC website service externally which will allow me to change the dog feeder settings from anywhere (like my phone). I'll be able to click a feed button on the site for example, which will let the BeagleBone know to push out a feed event to an Arduino, which will drive a motor to open a little custom dog food tote thing and feed the dogs!

My Rhythmic Crotch
Jan 13, 2011

You could host the control site on the BBB itself, no need for extra servers. Just forward a port from your router to be able to access it from the outside world. You can write a simple and secure controller site using python.

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal

My Rhythmic Crotch posted:

You could host the control site on the BBB itself, no need for extra servers. Just forward a port from your router to be able to access it from the outside world. You can write a simple and secure controller site using python.

Hm well that will really cut down on the complexity and potential problems; thanks a lot for the tip. This will also be a good excuse to learn Python. Gonna get the website boilerplate ready now...

yippee cahier
Mar 28, 2005

Well, you made me dust off my BBB and flash the eMMC with Debian. I actually wanted to build an automatic cat feeder but got distracted. What were you planning on using to portion food out?

My Rhythmic Crotch
Jan 13, 2011

Personally I was going to use one of these with some kind of load cell to weigh out portions.

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal

sund posted:

Well, you made me dust off my BBB and flash the eMMC with Debian. I actually wanted to build an automatic cat feeder but got distracted. What were you planning on using to portion food out?

Cool! Whoever is closer to finishing should create a project thread and we can compare implementations.

I had some stuff typed out but pretty much I'll be trying out some implementations similar what Rhythmic mentioned. Basically I will use a reference bowl on a scale up top to give me the desired food weight (so I can measure like two cups of food and just put it on the top bowl), and have a little slot pull back to dispense the food until the bottom scale is close to the top one. The bottom scale could probably be replaced with a calibrated time:food ratio on the door that could probably get close enough.

carticket
Jun 28, 2005

white and gold.

Why not use something like an Archimedes Screw: http://en.m.wikipedia.org/wiki/Archimedes'_screw

Drop food in one end with gravity and then you just run a stepper a certain number of turns to portion the food? You'd need to fabricate the screw most likely, or maybe if you're lucky you could find something appropriately sized to go inside a standard sized pipe.

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS
Big drill bits can definitely fit kibbles in the flutes.

e: that is a very fun sentence

Bad Munki
Nov 4, 2008

We're all mad here.


ante posted:

Big drill bits can definitely fit kibbles in the flutes.

TheresaJayne
Jul 1, 2011
I am trying to work out a way to have a computer/device inside an electronic safe to control when it opens.

I have toyed with the following.
1. Raspberry Pi running a website that directly controls the relay by use of a pi face shield.

2. An arduino uno or maybe nano which is programmed remotely and just sits there timing down until it reaches the agreed time and unlocks the safe.

The problem i have is that if the safe were to be locked for say 1 year, how would you be able to keep it working without needing some form of external power supply?

The safe I am looking to mod runs on 6v 4x 1.5v cells.

suggestions?

JawnV6
Jul 4, 2004

So hot ...
A MSP430 with a real time clock (RTC) would take less than 4 mAH over a year assuming some stupidly ideal conditions. That's about 1% of the worst AA you could find. A CR2032 coin cell would last 20 years.

If you're using a whole board like a RPi or Uno, you're going to waste a lot of power on things you don't need. I'm seeing current numbers for the Uno around 31mA, meaning 1 year will cost you 271,000 mAH. Significantly more than a AA. Bottom line, you need to shoot for a shorter duration, supply external power, or change your electronics.

What's the current failure mode of the safe if the battery runs out? Is it... fail safe?

TheresaJayne
Jul 1, 2011

JawnV6 posted:

A MSP430 with a real time clock (RTC) would take less than 4 mAH over a year assuming some stupidly ideal conditions. That's about 1% of the worst AA you could find. A CR2032 coin cell would last 20 years.

If you're using a whole board like a RPi or Uno, you're going to waste a lot of power on things you don't need. I'm seeing current numbers for the Uno around 31mA, meaning 1 year will cost you 271,000 mAH. Significantly more than a AA. Bottom line, you need to shoot for a shorter duration, supply external power, or change your electronics.

What's the current failure mode of the safe if the battery runs out? Is it... fail safe?

There is an emergency KEY even for the current system so if the battery fails the key can be used

I will have to look up some of these items, I know we have some dev boards from microchip lying around wonder if i can use one of them,

Although it would be nice if i could have some form of web access as well

JawnV6
Jul 4, 2004

So hot ...
4 AA's won't last a year's worth of WiFi. And if you're inside a metal box the signal strength takes a pretty big hit (read: more power). You're back to a hard-wired connection or some goofy setup with a small window of time every day.

Adbot
ADBOT LOVES YOU

TheresaJayne
Jul 1, 2011
I suppose the only thing i need is to ensure that if there is no power it remembers the time details so i guess some form of RTC with a pi, and have the case modified to have a usb power connector that you can use to power it if necessary

  • Locked thread