FlameSense

It’s been a while since I’ve posted here… Can’t say time has been much of a friend to me, to allow me to do some posting. Can’t say I’ve got too much of it now, but I thought I’d update the site with a little more of what I’ve been up to lately.

What I did in this past couple of (or 3, 4, was it?) months, apart from the University errands and projects, was a lil’ bit (more) of preparations for the Suceava Hard & Soft 2010 contest. It’s come, it’s gone, we worked hard, we came back. Sadly, not with the results we would have liked, but we came back with our heads held high and very proud of what we realized. This year, it was only a fifth place, maybe better luck next year for our faculty’s team!

Anyway, the reason I’m writing this post is to present you with a new application for the fireman of the future…

Basically, what we had to implement in Suceava was a SoNDa – Sensor Network for Data… What this means is, you’ve got a lot of sensors around you and you’ve got a modern smartphone. What you have to do (or had…) is to interface these wirelessly by using a smartphone. Build the hardware for acquiring and interpreting the readings from these these sensors, build the software for the phone, make a connection between these two and you’re ready to… Sounds simple, doesn’t it? Well, it’s not… :)

Having read the previous paragraph, you’re probably thinking: “Wwwhat?!?” Of course, you’d be right to think that… I gave a pretty general description about it… It’s because this year, the theme was fairly open to the contestants’ ideas… Which was great… ’cause what we came up with was, (in our minds, at least) brilliant!

I was talking something about the fireman of the future, wasn’t I? Ok, I’ll stop beating around the bush and tell you what I’m talking about…

This is FireSense.

If you’ve browsed around the linked site, you’ve probably seen what it’s about… If not, let me give you a small summary… Let us, for a few moments, assume that somewhere in the future, every building would have black boxes - fireproof boxes containing sensors and a board to process readings from these sensors.

Of course, there has to be a PDA somewhere, didn’t I say that? Did I say that? When…? :)

Yes, yes, okay, there does have to be one… And there actually is one… That’s the beauty of FireSense, actually. It’s on the fireman’s suit, placed on his hand, quickly available to the fireman when needed. Let’s assume it’s a robust and fire-resistant PDA

Ok, so how does it work? Basically, the fireman receives a fire alarm from a certain building. Before the mission, he spends a few moments downloading blueprints for the building, which also contain the locations of these black boxes. After this, he gets on his fire truck and goes on the mission. A few minutes later, he goes into the building and the software application on the PDA automatically connects to the black boxes in range of the PDA. This connection is done (as requested – wirelessly) through Bluetooth. As soon as it’s connected it starts reading the data from the sensors in real-time and stores this data on a server at the same time. This will help the fireman permanently know what is around him and what dangers are lurking… For example, if a wall is about to collapse, the accelerometers incorporated into it would warn the fireman (through the PDA) of this fact, and the fireman would not go anywhere near it. Long-term (as in, would-be next version), we coud use the readings from these in-the-wall-accelerometers to also warn the inhabitant of the building of upcoming earthquakes. But for now, we’re limited to saving fireman lives…

In our implementation, we have three black boxes. Two are functional prototypes, containing a PICDEM FS USB DemoBoard, with a PIC18F4550 8- bit microcontroller, with some C code on it (about 7/32 kB, so there’s a lot more space for expanding). This is interfaced (at the time being) to an accelerometer, a motion sensor, a temperature sensor and a simulated CO-2 sensor. To simulate the CO2, we used the on-board potentiometer.

The third is a PDA, which practically simulates the full functionality of such a black box.

And now for the surprise of this whole project… LabView! Mobile! That’s right, the PDA applications are done in LabView Mobile Module! This probably doesn’t sound like much to some of you… But figure that we built this fully functional application (Bluetooth communication + communication with the server + user interface) in two days. And this is because we had no idea on how to interface bluetooth. If we would have known that, we would have been done in less time… The easy programming and the (absent) need of struggling with building a user interface helped us to develop this application ten times quicker. And you can see the results for yourself. (Actually, I’m going to post a movie here with it working, ┬ácheck back in about two or three weeks…)

I almost forgot to mention the server application, which was built using Python… which was also very helpful, really; its ready-built functions helped us to develop our webserver application much quicker than normal…

That’s it! Sound interesting? It does to us and we know it has an application for the future – we’ve talked to a fireman, we know they would need such a device.

Please contact me for more details and source code for the project. I’ll try to post it here, as soon as I get it from the other guys. I’m also going to post the schematic files for the black box modules and the Gerbers…

Enjoy,

Tedi

Tags: , , , ,

Traffic lights controller

What we have here is a so-called “modern” traffic lights controller. Meaning, when you program this code on the BASYS board, what you will basically have is a genuine traffic lights simulator. Seeing as how the BASYS board has colored LEDs, I’ve used the first three (they’re green-yellow-red) to simulate the signal lights and also a down-counter counts down to when the signal lights are about to change.

Download the project from here,

Traffic_lights

and see here how it works:

Video023

Tags: , ,

Pulse Width Modulator

A pulse width modulator is a circuit that outputs a digital waveform, but with a selectable duty cycle.

The PWM VHDL module grabs the clock signal as an input and a 4-bit duty cycle selector and outputs an accurate waveform according to the selected duty cycle. It does this by use of a 4-bit counter which counts up on every clock. When it reaches the value of the duty cycle, the output value is reversed (i.e., goes to 0). Thus, each bit in the duty signal accounts for 100/16 = 6.25% of the duty cycle of the PWM output.

The project can be found here:

PWM

Hope it helps!

http://en.wikipedia.org/wiki/Pulse-width_modulation

Tags: , ,

Schmitt trigger input to the FPGA

This is an EDN design idea I’ve implemented. You can find the file with the design idea in the Doc folder, located in the archive below.

To all those who haven’t yet heard about a Schmitt trigger, this is a comparator circuit with feedback. Now, unlike a comparator, which changes its output once a threshold of voltage has been reached, the Schmitt trigger employs positive feedback to change its output based on two levels of voltage. That is, when the voltage level at the input is higher than a chosen threshold, the output of the Schmitt trigger changes to “1″. When the voltage level at the input is below the lower threshold, the output goes back to 0.

In order to create the positive feedback needed for a Schmitt trigger, you need a simple external circuit to your FPGA, which basically comes in the form of two resistors. The ratio between the resistors set the two thresholds of the Schmitt trigger (check the Doc directory in the project). We chose R1 to be 5kohms and R2 13kohms, so our thresholds were at about 0.8V (lower) and 2.4V (higher) for the Spartan3E’s input voltage of 3.3V.

You can also upgrade the external circuit of the FPGA while upgrading the internal one to obtain a few useful circuits, like a retriggerable or nonretriggerable monostable, or an oscillator, as described in the documentation .pdf file.

Trigger_Schmitt_input

Tags: , ,

Stopwatch

The VHDL implementation of the stopwatch counts up to a max value (in our case, 99.9). It counts every millisecond interval and asserts a tick signal when a millisecond has passed. When this reaches the value 9, another tick signal is asserted and the second counter increases by 1. In the same way, when the second interval gets to 9, the tens of seconds counter increases by 1.

The whole operation wraps back from 0 when all the counters have reached 9, i.e., when the stopwatch counts up to 99.9.

The go input signal controls whether the millisecond counter counts or not and thus if the stopwatch is working or not. If the go signal is not asserted, then the stopwatch is in a wait state, keeping the previous values.

You can download the VHDL source file from here:

stopwatch

Tags: , ,

Barrel shifter

A barrel shifter is a special shifter implemented in microcontrollers and microprocessors. It is capable of performing very fast (one-clock) multiple-position shifts.

The present version of the barrel shifter VHDL module receives a 4-bit data word, plus a 2-bit amount word, which specifies how many bits to shift the data word.

You can grab the module and test it, you just need to make a few adjustments to the project so it suits your FPGA and devel board. The project is tested and set up for, you guessed it, the BASYS.

Barrel_shifter

Enjoy!

Tags: , , ,

Hex to seven-segment decoder

… and speaking of seven-segment decoders (in the previous post), here you can find a useful little source file in VHDL.

In case you want to use such a little thing, I’ve taken about 5 minutes of my time one day to write this little source file to have it lying around whenever I want it.

hex_to_sseg

Note: this has been written for the seven-segment setting on my BASYS board, that is, a common-anode configuration. If you are to have a common-cathode configuration on your devel board (check the board’s schematic), you should reverse the values of all the bits in the provided source.

Enjoy!

Tags: , , ,

Pseudo-snake

On the more fun-side of projects, I thought what if I played a little with the seven-segment display module available on-board the BASYS? So, what I did in this project is to play a little with setting the an output vector (basically, each bit in the an vector is set to a different position in the seven-segment display – not that much of a philosophy really) and deciding when to light up each LED in the seven-segment display.

This is for all you BASYS owners out there, nothing too complex, just your average Saturday-afternoon fun with FPGAs…

Enjoy!

Pseudo_snake

Tags: , , , ,

Simple shift register

The project below is a simple many-bits shift register. Many, as in, as many as you like and need. The generic of the source controls how many bits the shift register can hold.

The module has three inputs (a clock, a reset and the input pin to the first flip-flop) and one output, which would be the output to the last flip-flop in the register.

The project is available here:

Simple_shift_register

Enjoy!

Tags: ,

Timer/counter

The timer/counter unit is a typical component inside microcontrollers. Basically, it receives a prescaled (or not) clock as an input and counts up to the maximum value and then recounts from 0.

Our timer/counter unit can count either up or down based on the value of the rev signal and will recount from 0 or the assigned max value (2 ^ number of bits). As other designs, it can be easily upgraded to more bits by changing the value of the generic.

The VHDL module attached below also has two signals (maxtick and mintick) that are asserted whenever the counter has counted up or down. People who’ve worked with microcontrollers before would call these “interrupts” and they would be right. If you were to use this timer unit in a microcontroller core, that is exactly what these signals would do

Download the timer/counter project from here:

Timer

Tags: , , ,